prep release
[p5sagit/Config-Any.git] / lib / Config / Any.pm
index 16dcd1b..7bdf2a6 100644 (file)
@@ -6,7 +6,7 @@ use warnings;
 use Carp;
 use Module::Pluggable::Object ();
 
-our $VERSION = '0.16';
+our $VERSION = '0.25';
 
 =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 } ) {
@@ -281,7 +287,7 @@ parameter to those methods.
 sub extensions {
     my $class = shift;
     my @ext
-        = map { $_->extensions } grep { $_->is_supported } $class->plugins;
+        = map { $_->extensions } $class->plugins;
     return wantarray ? @ext : \@ext;
 }