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.pm12
1 files changed, 8 insertions, 4 deletions
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;
}