#!perl -w
# Possible discrepancy between DBM::Deep and Perl's handling of exists()
use feature ':5.12';
use Test::More;
use strict;
my $h;
ok !exists $h->{a};
is $h->{a}, undef();
ok !exists $h->{a};
$h->{a} = undef();
ok exists $h->{a};
# From DBM::Deep 02_hash.t
my $db;
ok( !exists $db->{key4}, "exists() function works for keys that
aren't there" );
is( $db->{key4}, undef, "Autovivified key4" );
ok( exists $db->{key4}, "Autovivified key4 now exists" ) or
diag "DBM::Deep thinks this should succeed";
# From DBM::Deep 03_bighash.t
my $foo;
ok( !exists $foo->{does_not_exist}, "EXISTS works on large hashes for
non-existent keys" );
is( $foo->{does_not_exist}, undef, "autovivification works on large
hashes" );
ok( exists $foo->{does_not_exist}, "EXISTS works on large hashes for
newly-existent keys" ) or diag "DBM::Deep thinks this should succeed";;
done_testing;