From 39813bfb03d6a4d8f8a1401f90db9ce9b73583e9 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 25 Jan 2011 19:10:53 -0600 Subject: handle 'require VERSION' properly on 5.8 --- lib/circular/require.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/circular/require.pm b/lib/circular/require.pm index d5586ac..c4d6e1f 100644 --- a/lib/circular/require.pm +++ b/lib/circular/require.pm @@ -42,12 +42,16 @@ my $saved; sub _require { my ($file) = @_; - if (exists $seen{$file} && !$seen{$file}) { - warn "Circular require detected: $file (from " . caller() . ")\n"; + # on 5.8, if a value has both a string and numeric value, require will + # treat it as a vstring, so be sure we don't use the incoming value in + # string contexts at all + my $string_file = $file; + if (exists $seen{$string_file} && !$seen{$string_file}) { + warn "Circular require detected: $string_file (from " . caller() . ")\n"; } - $seen{$file} = 0; + $seen{$string_file} = 0; my $ret = $saved ? $saved->($file) : CORE::require($file); - $seen{$file} = 1; + $seen{$string_file} = 1; return $ret; } -- cgit v1.2.3-54-g00ecf