}) or die "How did this fail (no blist)?!\n";
my $value_sector = $blist->get_data_for( $key_md5 );
- return if ! $value_sector;
+ if ( !$value_sector ) {
+ # Autovivification
+ $value_sector = DBM::Deep::Engine::Sector::Null->new({
+ engine => $self,
+ data => undef,
+ });
+
+ $blist->write_md5( $key_md5, $key, $value_sector->offset );
+ }
return $value_sector->data;
}
ok( !exists $db->{key4}, "exists() function works for keys that aren't there" );
is( $db->{key4}, undef, "Autovivified key4" );
-TODO: {
- local $TODO = "Autovivification isn't correct yet";
- ok( exists $db->{key4}, "Autovivified key4 now exists" );
-}
+ok( exists $db->{key4}, "Autovivified key4 now exists" );
delete $db->{key4};
ok( !exists $db->{key4}, "And key4 doesn't exists anymore" );