X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FConfig-Any.git;a=blobdiff_plain;f=lib%2FConfig%2FAny.pm;h=1f4be5ee0784c8ba46eaf0888fa76ee4c1256019;hp=cd00963a4ad1045d5b843661f136aa38fd2483f2;hb=0bdc3e9bef6f841b341c32960565aaaa9551e2be;hpb=803bbb1153db2f996a881286fdfe81eaa3c75b24 diff --git a/lib/Config/Any.pm b/lib/Config/Any.pm index cd00963..1f4be5e 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.24'; =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 ); @@ -192,12 +194,16 @@ sub _load { for my $loader ( @try_plugins ) { next unless $loader->is_supported; $supported = 1; - my @configs - = eval { $loader->load( $filename, $loader_args{ $loader } ); }; + my @configs; + my $ok = do { + local $@; + @configs = eval { $loader->load( $filename, $loader_args{ $loader } ); }; + 1; + }; # fatal error if we used extension matching - croak "Error parsing $filename: $@" if $@ and $use_ext_lut; - next if $@ or !@configs; + croak "Error parsing $filename: $@" if !$ok and $use_ext_lut; + next if !$ok or !@configs; # post-process config with a filter callback if ( $args->{ filter } ) {