sub begin_work { use Data::Dumper; my $self = shift; my ($obj) = @_; unless ($self->supports('transactions')) { DBM::Deep->_throw_error( "Cannot begin_work unless transactions are supported" ); } if ( $self->trans_id ) { DBM::Deep->_throw_error( "Cannot begin_work within an active transaction" ); } my @slots = $self->read_txn_slots; print Dumper(@slots); my $found; for my $i ( 0 .. $self->num_txns-2 ) { print "i,$i\n"; next if $slots[$i]; $slots[$i] = 1; $self->set_trans_id( $i + 1 ); $found = 1; last; } unless ( $found ) { DBM::Deep->_throw_error( "Cannot allocate transaction ID" ); } $self->write_txn_slots( @slots ); if ( !$self->trans_id ) { DBM::Deep->_throw_error( "Cannot begin_work - no available transactions" ); } no Data::Dumper; return; }