Jos I. Boumans wrote:

On 21 Aug 2007, at 04:55, John E. Malmberg wrote:

The load conditional code does a require using the VMS format, and since it does not match the key in UNIX format, modules can be loaded twice. This showed up by causing the extract tests to emit diagnostics about routines being overridden.

This patch forces the %INC key to be in UNIX format so that the modules will not be loaded twice.

In 01_Module_Load.t, on VMS, the $file for the module will now be returned in UNIX format.

In 01_Module_Load_Conditional.t, some work arounds are needed for issues with VMS handling of UNIX pathnames incorrectly.

Since MLC uses Module::Load, wouldn't it just be an easier fix to always unixify paths on VMS?

How does this patch look for you?

--- local/oss/module-load/lib/Module/Load.pm    (revision 2064)
+++ local/oss/module-load/lib/Module/Load.pm    (revision 2065)
@@ -1,6 +1,6 @@
 package Module::Load;

-$VERSION = '0.10';
+$VERSION = '0.12';

 use strict;
 use File::Spec ();
@@ -56,6 +56,13 @@
                     : File::Spec->catfile( @parts );

     $file   .= '.pm' if $pm;
+
+    ### on perl's before 5.10 ([EMAIL PROTECTED]) if you require
+    ### a file in VMS format, it's stored in %INC in VMS
+    ### format. Therefor, better unixify it first
+    ### Patch in reply to John Malmbergs patch (as mentioned
+    ### above) on p5p Tue 21 Aug 2007 04:55:07
+    $file = VMS::Filespec::unixify($file) if $^O eq 'VMS';

     return $file;
 }

Yes, it looks like it will work.

Another issue has shown up with pp_require. It seems that if you are in directory foo, and it has a parent directory in @INC, you can do a require foo::bar and a require of bar.pm, and while they are the same file, this will not be detected by pp_require, and both will be loaded.

I do not see how this can be fixed except with a lot more code in pp_require to check the parent directory.

And those checks may fail on VMS because "foo/" on VMS can be multiple directories, such as "tom/", "dick/" and "harry/", so checking parent directory of that file will return one of those, and not the "foo/" needed for the matching the key to %INC.

Using a different syntax for the keys to %INC could break existing code.

It may be just better to document this as a limitation of the "require" statement.

-John
[EMAIL PROTECTED]
Personal Opinion Only

Reply via email to