From: jettero@cpan.org Date: Sat, 19 Jul 2008 13:08:46 +0000 (+0000) Subject: alternate between using transactions and not causes reference problems X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=403f8ed385d9813e83fc3e4e5ab0129067b310f1;p=dbsrgits%2FDBM-Deep.git alternate between using transactions and not causes reference problems git-svn-id: http://svn.ali.as/cpan/trunk/DBM-Deep@3825 88f4d9cd-8a04-0410-9d60-8f63309c3137 --- diff --git a/MANIFEST b/MANIFEST index 34a2d85..05dfd85 100644 --- a/MANIFEST +++ b/MANIFEST @@ -69,3 +69,4 @@ t/etc/db-0-983 t/etc/db-0-99_04 t/etc/db-1-0000 t/etc/db-1-0003 +t/53_misc_transactions.t diff --git a/t/53_misc_transactions.t b/t/53_misc_transactions.t new file mode 100644 index 0000000..fedcee8 --- /dev/null +++ b/t/53_misc_transactions.t @@ -0,0 +1,33 @@ + +# This was discussed here: +# http://groups.google.com/group/DBM-Deep/browse_thread/thread/a6b8224ffec21bab +# brought up by Alex Gallichotte + +use strict; +use Test; +use DBM::Deep; +use t::common qw( new_fh ); + +my ($fh, $filename) = new_fh(); +my $db = DBM::Deep->new( file => $filename, fh => $fh, ); + +plan tests => 3; + +eval { $db->{randkey()} = randkey() for 1 .. 10; }; ok($@, ""); + +eval { + $db->begin_work; + $db->{randkey()} = randkey() for 1 .. 10; + $db->commit; +}; +ok($@, ''); + +eval { $db->{randkey()} = randkey() for 1 .. 10; }; ok($@, ""); + +sub randkey { + our $i ++; + my @k = map { int rand 100 } 1 .. 10; + local $" = "-"; + + return "$i-@k"; +}