while ( $parent->{parent} ) {
$base = (
$parent->_type eq TYPE_HASH
- ? "\{$child->{parent_key}\}"
+ ? "\{q{$child->{parent_key}}\}"
: "\[$child->{parent_key}\]"
) . $base;
$parent = $parent->{parent};
}
if ( $base ) {
- $base = "\$db->get( '$child->{parent_key}' )->" . $base;
+ $base = "\$db->get( q{$child->{parent_key}} )->" . $base;
}
else {
- $base = "\$db->get( '$child->{parent_key}' )";
+ $base = "\$db->get( q{$child->{parent_key}} )";
}
}
return $base;
my $lhs = $self->_find_parent;
if ( $lhs ) {
if ( $self->_type eq TYPE_HASH ) {
- $lhs .= "->\{$orig_key\}";
+ $lhs .= "->\{q{$orig_key}\}";
}
else {
$lhs .= "->\[$orig_key\]";
$lhs .= "=$rhs;";
}
else {
- $lhs = "\$db->put('$orig_key',$rhs);";
+ $lhs = "\$db->put(q{$orig_key},$rhs);";
}
$self->_fileobj->audit($lhs);
cmp_deeply(
$db,
- noclass({
+ {
key1 => 'value1',
key2 => 'value2',
array1 => [ 'elem0', 'elem1', 'elem2', ],
subkey2 => "subvalue2",
subkey3 => useclass( bless {}, 'Foo' ),
},
- }),
+ },
"Everything matches",
);
--- /dev/null
+use strict;
+use Test::More tests => 3;
+use Test::Deep;
+use t::common qw( new_fh );
+
+use_ok( 'DBM::Deep' );
+
+my ($fh, $filename) = new_fh();
+my $db1 = DBM::Deep->new(
+ file => $filename,
+ locking => 1,
+ autoflush => 1,
+);
+
+$db1->begin_work;
+
+ my $x = { a => 'b' };;
+ $db1->{x} = $x;
+
+$db1->commit;
+
+is( $db1->{x}{a}, 'b', "DB1 X-A is good" );
+is( $x->{a}, 'b', "X's A is good" );