X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FConfig-Any.git;a=blobdiff_plain;f=lib%2FConfig%2FAny%2FPerl.pm;h=5d8e0a580275a79bd648282e0ad91b985cd3ae75;hp=6c20cedeb0efa7effe7c34b38c6146704fd62820;hb=7c2181827882c125de98ccbe16402f5b277a3f44;hpb=f0e3c2214342d0d8a8839009b8b9c7e6bfbc7ab2 diff --git a/lib/Config/Any/Perl.pm b/lib/Config/Any/Perl.pm index 6c20ced..5d8e0a5 100644 --- a/lib/Config/Any/Perl.pm +++ b/lib/Config/Any/Perl.pm @@ -3,6 +3,8 @@ package Config::Any::Perl; use strict; use warnings; +my %cache; + =head1 NAME Config::Any::Perl - Load Perl config files @@ -42,7 +44,14 @@ Attempts to load C<$file> as a Perl file. sub load { my $class = shift; my $file = shift; - return eval { require $file }; + my $content; + + unless ( $content = $cache{ $file } ) { + $content = eval { require $file }; + $cache{ $file } = $content; + } + + return $content; } =head1 AUTHOR