5 # This is here because Tie::File is STOOPID.
13 filename => $filename,
21 open( my $fh, $self->{filename} );
31 open( my $fh, $self->{filename} );
42 my ($db_orig, $audit) = @_;
43 my $export = $db_orig->export;
45 my ($fh2, $file2) = new_fh();
46 my $db = DBM::Deep->new({
52 warn "$_ -> $@\n" if $@;
55 my $export2 = $db->export;
56 # use Data::Dumper;warn Dumper $export2;
58 cmp_deeply( $export2, $export, "And recovery works" );
61 use Test::More tests => 12;
63 use t::common qw( new_fh );
65 use_ok( 'DBM::Deep' );
67 my ($audit_fh, $audit_file) = new_fh();
70 tie @audit, 'My::Tie::File', $audit_file;
72 my ($fh, $filename) = new_fh();
73 my $db = DBM::Deep->new({
75 audit_file => $audit_file,
78 isa_ok( $db, 'DBM::Deep' );
81 $audit[0], qr/^\# Database created on/,
82 "Audit file header written to",
86 testit( $db, \@audit );
89 testit( $db, \@audit );
91 $db->{bar} = { a => 1 };
92 testit( $db, \@audit );
94 $db->{baz} = [ 1 .. 2 ];
95 testit( $db, \@audit );
100 testit( $db, \@audit );
105 $db = DBM::Deep->new({
107 audit_file => $audit_file,
111 testit( $db, \@audit );
114 testit( $db, \@audit );
117 testit( $db, \@audit );
119 $db->{blessed} = bless { a => 5, b => 3 }, 'Floober';
120 testit( $db, \@audit );