From: Brian Cassidy Date: Fri, 19 Dec 2008 12:54:48 +0000 (+0000) Subject: ensure require() happens against plugin specified in force_plugins X-Git-Tag: v0.17~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5d3ad6eb7bf1f5ac814bf92e9b7098b9b650414a;p=p5sagit%2FConfig-Any.git ensure require() happens against plugin specified in force_plugins --- diff --git a/Changes b/Changes index 593c71f..61e8313 100644 --- a/Changes +++ b/Changes @@ -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) diff --git a/lib/Config/Any.pm b/lib/Config/Any.pm index cd00963..8699b55 100644 --- a/lib/Config/Any.pm +++ b/lib/Config/Any.pm @@ -6,7 +6,7 @@ use warnings; use Carp; use Module::Pluggable::Object (); -our $VERSION = '0.16'; +our $VERSION = '0.17'; =head1 NAME @@ -142,7 +142,9 @@ sub _load { } # 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 ); diff --git a/t/65-force_plugins.t b/t/65-force_plugins.t new file mode 100644 index 0000000..5cbf9ff --- /dev/null +++ b/t/65-force_plugins.t @@ -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' ); +}