[Catalyst-commits] r6723 - in trunk/Config-Any: . lib/Config/Any t
bricas at dev.catalyst.perl.org
bricas at dev.catalyst.perl.org
Thu Aug 23 13:30:41 GMT 2007
Author: bricas
Date: 2007-08-23 13:30:41 +0100 (Thu, 23 Aug 2007)
New Revision: 6723
Modified:
trunk/Config-Any/Changes
trunk/Config-Any/lib/Config/Any/Perl.pm
trunk/Config-Any/t/53-perl.t
Log:
added a simple cache to the perl parser so it can load the same file twice (RT #28812)
Modified: trunk/Config-Any/Changes
===================================================================
--- trunk/Config-Any/Changes 2007-08-23 08:52:48 UTC (rev 6722)
+++ trunk/Config-Any/Changes 2007-08-23 12:30:41 UTC (rev 6723)
@@ -1,27 +1,31 @@
Revision history for Config-Any
+0.08 Wed Aug 23 2007
+ pass config options to each parser
+ fix for loading the same perl config twice (RT #28812)
+
0.07 Mon Feb 26 2007
promote 0.06_01 to non-dev.
0.06_01 Sun Feb 25 19:23:00 2007
- fixed bug [rt.cpan.org #25143] make tests fails
- - t/61_features.t had 1 more test added than was set to skip if the INI parser
- was not installed. Fixed by s/9/10/ on the skip() line.
+ fixed bug [rt.cpan.org #25143] make tests fails
+ - t/61_features.t had 1 more test added than was set to skip if the INI parser
+ was not installed. Fixed by s/9/10/ on the skip() line.
0.06 Thu Feb 22 21:05:00 2007
- removed reference to Test::Exception, bumped version number
+ removed reference to Test::Exception, bumped version number
0.05 Wed Feb 21 22:00:00 2007
- added support for:
- 'force_plugins => [ qw(Config::Any::Foo Config::Any::Blah) ]' parameter
- to load_(files|stems)
- $Config::Any::INI::MAP_SECTION_SPACE_TO_NESTED_KEY - boolean, defaulting
- to on, controlling whether to map spaces in INI section headings
- to nested hashrefs
- both as requested by Evan Kaufman
+ added support for:
+ - 'force_plugins => [ qw(Config::Any::Foo Config::Any::Blah) ]' parameter
+ to load_(files|stems)
+ - $Config::Any::INI::MAP_SECTION_SPACE_TO_NESTED_KEY - boolean, defaulting
+ to on, controlling whether to map spaces in INI section headings
+ to nested hashrefs
+ both as requested by Evan Kaufman
0.04 Mon Aug 7 15:15:15 2006
- Initial CPAN-worthy release with proper test suite
+ Initial CPAN-worthy release with proper test suite
0.01 - 0.03 dev releases
Modified: trunk/Config-Any/lib/Config/Any/Perl.pm
===================================================================
--- trunk/Config-Any/lib/Config/Any/Perl.pm 2007-08-23 08:52:48 UTC (rev 6722)
+++ trunk/Config-Any/lib/Config/Any/Perl.pm 2007-08-23 12:30:41 UTC (rev 6723)
@@ -3,6 +3,8 @@
use strict;
use warnings;
+my %cache;
+
=head1 NAME
Config::Any::Perl - Load Perl config files
@@ -42,7 +44,14 @@
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
Modified: trunk/Config-Any/t/53-perl.t
===================================================================
--- trunk/Config-Any/t/53-perl.t 2007-08-23 08:52:48 UTC (rev 6722)
+++ trunk/Config-Any/t/53-perl.t 2007-08-23 12:30:41 UTC (rev 6723)
@@ -1,11 +1,17 @@
-use Test::More tests => 2;
+use Test::More tests => 3;
use Config::Any::Perl;
-my $config = eval { Config::Any::Perl->load( 't/conf/conf.pl' ) };
+my $file = 't/conf/conf.pl';
+my $config = eval { Config::Any::Perl->load( $file ) };
SKIP: {
- skip "Couldn't Load Perl plugin", 2 if $@;
+ skip "Couldn't Load Perl plugin", 3 if $@;
+
ok( $config );
is( $config->{ name }, 'TestApp' );
+
+ my $config_2 = eval { Config::Any::Perl->load( $file ) };
+
+ is_deeply( $config_2, $config, 'multiple loads of perl configs' );
}
More information about the Catalyst-commits
mailing list