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?

Or alternately, perhaps, to grovel over the keys of %INC, crushing and
trimming punctuation, and comparing against that.

Or wait until someone sends a bug report.

Volunteers?


Has Inline _ever_ been tested under VMS?  It could be interesting.
Of course, if Inline has never supported VMS, then VMS folk are
unlikely to be on this list, so... .

Mitchell



   Message-ID: <01de01c27a24$03356f00$5db1dccb@sisyphusii330h>
   Subject: Re: Hmmm:Inline-0.44/Inline::C v5.6.1 - solved ?
   Date: Wed, 23 Oct 2002 09:37:31 +1000
   From: kalinabears[at]hdc.com.au (Sisyphus)

   Ok ... my problem vanishes if I do the following:

       $realname =~ s/\\/\//; # change '\' to '/'
       my $realpath = $INC{$realname}
         or croak M27_module_not_indexed($realname);
        # a few lines further on:
         $realname =~ s/\//\\/g; #change '/' to '\'
       File::Spec->catfile(@endparts) eq $realname
       or croak M28_error_grokking_path($realpath);

   (The only code I've added in the above is the 2 regexes.)

   I can now build Math::Simple and run the scripts that use any of my
   inline-built modules.

   Cheers,
   Rob

Reply via email to