On 23/10/02 13:09 -0400, Mitchell N Charity wrote:
> It looks like %INC's concept of a canonical filename differs
> from File::Spec's.  And may get pretty weird.
> 
> Here is a version of the patch that was suggested:
> 
> --- Inline.pm Wed Oct 23 12:21:00 2002
> +++ Inline.pm_new     Wed Oct 23 12:21:00 2002
> @@ -428,8 +428,10 @@
>  
>      my @pkgparts = split(/::/, $o->{API}{pkg});
>      my $realname = File::Spec->catfile(@pkgparts) . '.pm';
> -    my $realpath = $INC{$realname}
> -      or croak M27_module_not_indexed($realname);
> +    my $realname_for_inc = $realname;
> +       $realname_for_inc =~ s/\\/\//g if $^O =~ /Win32/i;
> +    my $realpath = $INC{$realname_for_inc}
> +      or croak M27_module_not_indexed($realname_for_inc);
>  
>      my ($volume,$dir,$file) = File::Spec->splitpath($realpath);
>      my @dirparts = File::Spec->splitdir($dir);
> 
> 
> $^O is a pattern match rather than eq, because some versions of perl
> seem to have gotten it wrong (or so a quick grep for $^O in the change
> log suggests).
> 
> 
> I have not tested this under Windows.  Just linux.
> 
> Dos may require something similar.
> 
> It looks like VMS, and perhaps os2, are also playing games.
> Related files include
>   perl.c      (eg, S_incpush)
>   vms/vms.c   (eg, ...tounix...)
>   os2/os2.c   (eg, perllib_mangle)
> I only grepped about briefly, so I'm no doubt missing things.
> As a hack, it might be worth seeing what unixify() (from
> VMS::Filespec??) in File::Spec::VMS does.
> 
> The Right Thing(tm) is to determine whether there is any portable way
> to assemble filenames for %INC.  A post to perl5-porters?

I pinged the p5p on this last night. They said that the keys of %INC always
use Unix separators. So the right thing to do is use
File::Spec::Unix->catdir() for %INC keys. That's what I did in TRIAL8.


Cheers, Brian

Reply via email to