I've never done transactions (in terms of programming), therefore I don't know if there is something wrong with my script or something else:
#!/usr/bin/env perl
use warnings;
use 5.012;
use DBM::Deep;
my $db = DBM::Deep->new( 'foo.db' );
my $trans = $db->supports( 'transactions' );
say 'Does ', $trans ? '' : 'NOT ', 'support transactions';
$db->{key} = 'value';
$db->begin_work;
$db->{key1} = 'value2';
$db->rollback;
$db->{key1} = 'value1';
$db->commit;
Output:
# Does support transactions
# DBM::Deep: Cannot allocate transaction ID at ./perl1.pl line 12
Part of comment:
my $db = DBM::Deep->new( file => 'my.db', num_txns => 1 );
$db->{key} = 'value';
$db->begin_work;
$db->{key1} = 'value2';
$db->rollback;
$db->begin_work;
$db->{key1} = 'value1';
$db->commit;