From: Brian Cassidy Date: Fri, 24 Apr 2015 01:32:31 +0000 (-0300) Subject: do not clobber $@ (RT #103061) X-Git-Tag: v0.25~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FConfig-Any.git;a=commitdiff_plain;h=0bdc3e9bef6f841b341c32960565aaaa9551e2be do not clobber $@ (RT #103061) --- diff --git a/lib/Config/Any.pm b/lib/Config/Any.pm index c9f19cd..1f4be5e 100644 --- a/lib/Config/Any.pm +++ b/lib/Config/Any.pm @@ -194,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 } ) {