use Carp;
use Module::Pluggable::Object ();
-our $VERSION = '0.15';
+our $VERSION = '0.27';
=head1 NAME
}
# 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 );
if ( $use_ext_lut ) {
$filename =~ m{\.($extension_re)\z};
- if( !$1 ) {
+ if ( !$1 ) {
$filename =~ m{\.([^.]+)\z};
croak "There are no loaders available for .${1} files";
}
for my $loader ( @try_plugins ) {
next unless $loader->is_supported;
$supported = 1;
- my @configs
- = eval { $loader->load( $filename, $loader_args{ $loader } ); };
+ my @configs;
+ my $err = do {
+ local $@;
+ @configs = eval { $loader->load( $filename, $loader_args{ $loader } ); };
+ $@;
+ };
# fatal error if we used extension matching
- croak "Error parsing $filename: $@" if $@ and $use_ext_lut;
- next if $@ or !@configs;
+ croak "Error parsing $filename: $err" if $err and $use_ext_lut;
+ next if $err or !@configs;
# post-process config with a filter callback
if ( $args->{ filter } ) {
map { ref $_ ? join( ' ', @$_ ) : $_ } $module->requires_all_of );
}
if ( $module->can( 'requires_any_of' ) ) {
- return 'one of ' . join( ' or ', $module->requires_any_of );
+ return 'one of '
+ . join( ' or ',
+ map { ref $_ ? join( ' ', @$_ ) : $_ } $module->requires_any_of );
}
}
sub plugins {
my $class = shift;
+
# filter out things that don't look like our plugins
return grep { $_->isa( 'Config::Any::Base' ) } $class->finder->plugins;
}
sub extensions {
my $class = shift;
- my @ext = map { $_->extensions } $class->plugins;
+ my @ext
+ = map { $_->extensions } $class->plugins;
return wantarray ? @ext : \@ext;
}
=head1 DEPENDENCIES
-L<Module::Pluggable|Module::Pluggable>
+L<Module::Pluggable::Object|Module::Pluggable::Object>
And at least one of the following:
L<Config::General|Config::General>