R
Rich
According to camel p.300:
"The key will be the module filename"
I therefore tried the following to test whether Data:umper (for example)
had been used:
use File::Spec;
use Data:umper;
my $filename = File::Spec->catfile("Data", "Dumper.pm");
print $INC{$filename} ? "yes\n" : "no\n"; # Fails on Win32
But although it worked on Linux, it failed on Win32 where the key is
actually the same as under Linux:
print $INC{"Data/Dumper.pm"} ? "yes\n" : "no\n"; # OK on Win32 and Linux
I know Win32 perl allows '/' as well as '\' directory separators, but now
I'm not sure of the correct way to build %INC keys. Is it:
1) The key is actually the same on all platforms. Ie $INC{"Data/Dumper.pm"}
will work on all platforms (Mac, VMS etc).
2) The key must use the system directory separator - in that case, since
File::Spec->catfile didn't work, where is the "correct" system directory
separator defined? Equally, do I need to be careful with how I handle
".pm" extensions?
If the answer is 2), does anyone have tested code they could post here to
handle this?
Many thanks,
"The key will be the module filename"
I therefore tried the following to test whether Data:umper (for example)
had been used:
use File::Spec;
use Data:umper;
my $filename = File::Spec->catfile("Data", "Dumper.pm");
print $INC{$filename} ? "yes\n" : "no\n"; # Fails on Win32
But although it worked on Linux, it failed on Win32 where the key is
actually the same as under Linux:
print $INC{"Data/Dumper.pm"} ? "yes\n" : "no\n"; # OK on Win32 and Linux
I know Win32 perl allows '/' as well as '\' directory separators, but now
I'm not sure of the correct way to build %INC keys. Is it:
1) The key is actually the same on all platforms. Ie $INC{"Data/Dumper.pm"}
will work on all platforms (Mac, VMS etc).
2) The key must use the system directory separator - in that case, since
File::Spec->catfile didn't work, where is the "correct" system directory
separator defined? Equally, do I need to be careful with how I handle
".pm" extensions?
If the answer is 2), does anyone have tested code they could post here to
handle this?
Many thanks,