remove caching code from ::Perl
[p5sagit/Config-Any.git] / lib / Config / Any / Perl.pm
index fee9e4d..6d214f2 100644 (file)
@@ -5,8 +5,6 @@ use warnings;
 
 use base 'Config::Any::Base';
 
-my %cache;
-
 =head1 NAME
 
 Config::Any::Perl - Load Perl config files
@@ -47,11 +45,13 @@ sub load {
     my $class = shift;
     my $file  = shift;
     my $content;
-
-    unless ( $content = $cache{ $file } ) {
-        $content = require $file;
-        $cache{ $file } = $content;
+    my $exception;
+    {
+        local $@;
+        $content = do $file;
+        $exception = $@;
     }
+    die $exception if $exception;
 
     return $content;
 }