1use Config::Std; 2use Test::More 'no_plan'; 3 4my %data = ( 5 'FOO' => { 6 'foo1' => 'defined', 7 'foo2' => undef, 8 }, 9); 10 11local $SIG{__WARN__} = sub { 12 ok 0 => "Bad warning: @_"; 13}; 14 15my $output; 16 17ok !eval{ write_config %data => \$output } => 'Write failed as expected'; 18 19like $@, qr/\ACan't save undefined value for key {'FOO'}{'foo2'}/ 20 => 'Failed with expected exception'; 21