From 5afc70702505b74c7415b954341a653a1c823cd9 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 18 Jul 2011 17:22:47 -0500 Subject: work around annoying base.pm behavior --- lib/circular/require.pm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'lib') 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; } -- cgit v1.2.3-54-g00ecf