# tainted. untaint for backwards compatibility.
my ($cwd) = Cwd::cwd() =~ /\A(.*)\z/s;
$content = do File::Spec->rel2abs($file, $cwd);
- $exception = $@;
+ $exception = $@ || $!
+ if !defined $content;
}
die $exception if $exception;
use strict;
use warnings;
-use Test::More tests => 9;
+use Test::More tests => 12;
use Config::Any;
use Config::Any::Perl;
ok( !$config, 'config load failed' );
ok( $@, "error thrown ($@)" );
}
+
+# test missing config
+{
+ my $file = 't/invalid/missing.pl';
+ my $config;
+ my $loaded = eval {
+ $config = Config::Any::Perl->load( $file );
+ 1;
+ };
+
+ ok( !$loaded, 'config load failed' );
+ ok( !$config, 'config load failed' );
+ ok( $@, "error thrown ($@)" );
+}