pjcj/Devel--Cover — pull request #32 by wchristian (2012-11-09 10:51:09+00:00)
Title: filter paths contained in CWD out of @Inc

When collecting coverage, a user normally wants to cover modules contained within the tree of CWD. In order to actually load these modules there are various methods, one of which being $ENV{PERL5LIB}. However this method puts paths into @INC at compile time, at which time Devel::Cover stores the paths to be ignored via regex comparisons of the absolute paths. This normally does not impact Devel::Cover, as the Perl `require` mechanism does some naive detection of whether a module path is contained within CWD, and if so, loads it with a relative path; thus preventing a match with the stored paths and also preventing the module from being ignored.

However, as mentioned, the containment detection mechanism is quite naive and can fail on string differences that are irrelevant on the executing operating or file system.

This patch filters paths before they are stored for ignoring, and removes all paths it can detect as being contained within CWD. It is not perfect and will for example not be able to detect containment on linux or mac in file systems whose case tolerancy differs from the default file system. It does however fix `cover -test` on windows, and stops the coverage collection output from lying about which paths are ignored.