Commit | Line | Data |
---|---|---|
403f8ed3 | 1 | |
2 | # This was discussed here: | |
3 | # http://groups.google.com/group/DBM-Deep/browse_thread/thread/a6b8224ffec21bab | |
4 | # brought up by Alex Gallichotte | |
5 | ||
6 | use strict; | |
f0276afb | 7 | use warnings FATAL => 'all'; |
09dd8113 | 8 | |
9 | use Test::More tests => 4; | |
403f8ed3 | 10 | use t::common qw( new_fh ); |
11 | ||
09dd8113 | 12 | use_ok( 'DBM::Deep' ); |
13 | ||
403f8ed3 | 14 | my ($fh, $filename) = new_fh(); |
f0276afb | 15 | my $db = DBM::Deep->new( file => $filename, fh => $fh ); |
403f8ed3 | 16 | |
09dd8113 | 17 | eval { $db->{randkey()} = randkey() for 1 .. 10; }; ok(!$@, "No eval failures"); |
403f8ed3 | 18 | |
19 | eval { | |
f0276afb | 20 | # $db->begin_work; |
403f8ed3 | 21 | $db->{randkey()} = randkey() for 1 .. 10; |
f0276afb | 22 | # $db->commit; |
403f8ed3 | 23 | }; |
f0276afb | 24 | ok(!$@, "No eval failures from the transaction"); |
403f8ed3 | 25 | |
09dd8113 | 26 | eval { $db->{randkey()} = randkey() for 1 .. 10; }; ok(!$@, "No eval failures"); |
403f8ed3 | 27 | |
28 | sub randkey { | |
29 | our $i ++; | |
30 | my @k = map { int rand 100 } 1 .. 10; | |
31 | local $" = "-"; | |
32 | ||
33 | return "$i-@k"; | |
34 | } |