[Catalyst-commits] r8927 - in trunk/Config-Any: . lib/Config t

bricas at dev.catalyst.perl.org bricas at dev.catalyst.perl.org
Fri Dec 19 12:54:49 GMT 2008


Author: bricas
Date: 2008-12-19 12:54:48 +0000 (Fri, 19 Dec 2008)
New Revision: 8927

Added:
   trunk/Config-Any/t/65-force_plugins.t
Modified:
   trunk/Config-Any/Changes
   trunk/Config-Any/lib/Config/Any.pm
Log:
ensure require() happens against plugin specified in force_plugins

Modified: trunk/Config-Any/Changes
===================================================================
--- trunk/Config-Any/Changes	2008-12-19 05:34:20 UTC (rev 8926)
+++ trunk/Config-Any/Changes	2008-12-19 12:54:48 UTC (rev 8927)
@@ -1,5 +1,8 @@
 Revision history for Config-Any
 
+0.17 XXX
+    - ensure require() happens against plugin specified in force_plugins.
+
 0.16 Mon 17 Nov 2008
     - fix up branches test which did not handle the errors thrown by
       changes from the last release (RT #40948)

Modified: trunk/Config-Any/lib/Config/Any.pm
===================================================================
--- trunk/Config-Any/lib/Config/Any.pm	2008-12-19 05:34:20 UTC (rev 8926)
+++ trunk/Config-Any/lib/Config/Any.pm	2008-12-19 12:54:48 UTC (rev 8927)
@@ -6,7 +6,7 @@
 use Carp;
 use Module::Pluggable::Object ();
 
-our $VERSION = '0.16';
+our $VERSION = '0.17';
 
 =head1 NAME
 
@@ -142,7 +142,9 @@
     }
 
     # figure out what plugins we're using
-    my @plugins = $force ? @{ $args->{ force_plugins } } : $class->plugins;
+    my @plugins = $force
+        ? map { eval "require $_;"; $_; } @{ $args->{ force_plugins } }
+        : $class->plugins;
 
     # map extensions if we have to
     my ( %extension_lut, $extension_re );

Added: trunk/Config-Any/t/65-force_plugins.t
===================================================================
--- trunk/Config-Any/t/65-force_plugins.t	                        (rev 0)
+++ trunk/Config-Any/t/65-force_plugins.t	2008-12-19 12:54:48 UTC (rev 8927)
@@ -0,0 +1,16 @@
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+
+use Config::Any;
+
+{
+    my $result = eval {
+        Config::Any->load_files(
+            { files => [ 't/conf/conf.pl' ], force_plugins => [ 'Config::Any::Perl' ] } );
+    };
+
+    ok( $result, 'config loaded' );
+    ok( !$@, 'no error thrown' );
+}




More information about the Catalyst-commits mailing list