Tie-Hash-Vivify

 view release on metacpan or  search on metacpan

t/00-basics.t  view on Meta::CPAN

ok(exists $vivi->{foo}, 'Things that exist exist() ...');
ok(!exists $vivi->{nopers}, "and things that don't don't exist().");

# now make a copy as a normal hash
my %notvivi = ();
$notvivi{foo} = 'default0';
$notvivi{bar} = "my data";
$notvivi{baz} = "default1";
SKIP: {
    skip "scalar() mysteriously broken on Ye Olde Perle", 1,
        unless($] gt 5.008002);
    is(scalar(%{$vivi}), scalar(%notvivi), "scalar() works, as if anyone's likely to ever bother");
}

%{$vivi} = ();
is_deeply([keys %{$vivi}], [], "can clear the hash");
is($vivi->{foo}, 'default2', "it's still magic!");
delete($vivi->{foo});
is_deeply([keys %{$vivi}], [], "can delete keys");

# vim: ft=perl :



( run in 0.666 second using v1.01-cache-2.11-cpan-cc502c75498 )