The check_install method has an unfortunate side effect when using @INC entries which are
objects or references. We're using a system that has such an object, and one of the things our
object does when it's INC method is called is set the %INC entry for the requested file.
However, since check_install isn't loading the module in question, just checking for it's
existence, this has the side effect of breaking code that subsequently tries to load it, since it
looks like it's already been loaded.
The attached, very simple patch should be perfectly valid for all of the @INC uses cases that are
references. Basically, if the %INC entry wasn't there before we looked for the module, delete it
afterwards.
Subject: | Module-Load-Conditional-0.38-inc-objects.patch |
diff -rc Module-Load-Conditional-0.38/lib/Module/Load/Conditional.pm Module-Load-Conditional-0.38-inc-objects/lib/Module/Load/Conditional.pm
*** Module-Load-Conditional-0.38/lib/Module/Load/Conditional.pm 2010-04-23 07:43:20.000000000 -0700
--- Module-Load-Conditional-0.38-inc-objects/lib/Module/Load/Conditional.pm 2010-08-31 12:13:28.000000000 -0700
***************
*** 204,209 ****
--- 204,211 ----
if ( ref $dir ) {
### @INC hook -- we invoke it and get the filehandle back
### this is actually documented behaviour as of 5.8 ;)
+
+ my $existed_in_inc = $INC{$file_inc};
if (UNIVERSAL::isa($dir, 'CODE')) {
($fh) = $dir->($dir, $file);
***************
*** 222,227 ****
--- 224,231 ----
}
$filename = $INC{$file_inc} || $file;
+
+ delete $INC{$file_inc} if not $existed_in_inc;
} else {
$filename = File::Spec->catfile($dir, $file);
Only in Module-Load-Conditional-0.38-inc-objects/lib/Module/Load: Conditional.pm~