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=1dd1499e50b6defa6e025d4654f41d048ccff8d2;hp=6c20cedeb0efa7effe7c34b38c6146704fd62820;hb=83020fbd096a2523ceedbb3ea1e9b99e030f994c;hpb=e0c0c283d718e11db7e71a002fee6642ce1b73bd diff --git a/lib/Config/Any/Perl.pm b/lib/Config/Any/Perl.pm index 6c20ced..1dd1499 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