Subject: | paths passed to Test::Harness should use forward slashes on win32? |
Some of what I write here is almost certainly wrong-headed, but I'm not sure where to start approaching this. Please consider this an open discussion rather than a bug report.
12:33 <@ether> are slashes forward or backwards in %INC on win32?
12:34 <@ether> I'm seeing some test reports from strawberry that suggest they are forward, which seems bizarre, as it makes for inconsistent path names, e.g. in
http://www.cpantesters.org/cpan/report/fc962223-6bf5-1014-ae06-e62309253afe
12:34 <+dipsy> [ CPAN Testers Reports: Report for Dist-Zilla-Plugin-Test-Compile-2.019 ]
12:34 <@ether> Mithaldu: ^^ you'd probably know?
12:35 < Mithaldu> sec
12:36 < Mithaldu> ether: i see forward slashes
12:36 <@ether> in non-strawberry as well?
12:37 < Mithaldu> in activeperl
12:37 <@ether> ok thanks
12:37 <@ether> that still seems very weird though!
12:37 < alh> I believe they should always be forward so that code works cross-platform
12:37 < Mithaldu> 'Data/Dumper.pm' => 'C:/Perl/site/lib/Data/Dumper.pm'
12:37 < Mithaldu> C:\Windows\System32>perl -e "use lib 'c:\\Perl\\site\\lib';use Data::Dumper; print Dumper \%INC"
12:37 < Mithaldu> 'Data/Dumper.pm' => 'c:\\Perl\\site\\lib/Data/Dumper.pm'
12:38 < Mithaldu> i guess something mangled @INC to add that
12:38 <@ether> yeah I'm getting inconsistent slashes in the filename printed in a warn() message
12:38 < Mithaldu> normalizing is good :)
12:39 <@jdb> 'require' takes whatever is in @INC
12:39 <@jdb> Perl only normalizes the lib and site/lib entries
12:40 <@jdb> (when it adds them itself)
12:42 <@ether> maybe this is a Module::Build::Tiny issue, then? the path is being built up via 'perl.exe ./Build test' which passes a lib option through to Test::Harness
12:42 <@ether> the root problem I see is that it seems pretty hard to predict what the full path is going to look like, if bits have forward slashes and other bits are backwards
12:43 * ether can punt this over to leont to see what he thinkgs (and certainly take it off this channel)
12:43 <@ether> thanks all!
Should the 'lib' argument that is passed to Test::Harness in MBT be
constructed with forward slashes, rather than using the arch-specific
implementation that rel2abs and catdir provide?
It seems pretty bizarre that a simple warn() message produced by a module
should result in the filename containing inconsistent slashes, and since %INC
entries use forward slashes in their keys, and it also looks like @INC entries
use forward slashes too (at least, the strawberry build in the test report I
quote here uses forward slashes in @INC), the remainder of the paths should
also use forward slashes.
Or could it be that either/both should be supported, so we should be flexible
as to what the filename should look like (i.e. my failing test here is being
improperly strict)? How can we predict what an absolute path will look like
on win32?