summaryrefslogtreecommitdiffstats
path: root/lib/circular/require.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/circular/require.pm')
-rw-r--r--lib/circular/require.pm17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/circular/require.pm b/lib/circular/require.pm
index c4d6e1f..6a8c0be 100644
--- a/lib/circular/require.pm
+++ b/lib/circular/require.pm
@@ -50,7 +50,22 @@ sub _require {
warn "Circular require detected: $string_file (from " . caller() . ")\n";
}
$seen{$string_file} = 0;
- my $ret = $saved ? $saved->($file) : CORE::require($file);
+ my $ret;
+ # XXX ugh, base.pm checks against the regex
+ # /^Can't locate .*? at \(eval / to see if it should suppress the error
+ # but we're not in an eval anymore... fake it for now, but this will
+ # definitely break if some other module that overrides CORE::require tries
+ # to do the same thing
+ if (caller eq 'base') {
+ my $mod = $file;
+ $mod =~ s+[/\\]+::+g;
+ $mod =~ s+\.pm$++;
+ $ret = $saved
+ ? $saved->($file) : eval "CORE::require($mod)";
+ }
+ else {
+ $ret = $saved ? $saved->($file) : CORE::require($file);
+ }
$seen{$string_file} = 1;
return $ret;
}