1 package File
::KDBX
::Transaction
;
2 # ABSTRACT: Make multiple database edits atomically
7 use Devel
::GlobalDestruction
;
8 use File
::KDBX
::Util
qw(:class);
11 our $VERSION = '999.999'; # VERSION
15 $txn = File
::KDBX
::Transaction-
>new($object);
17 Construct a new database transaction
for editing an object atomically
.
24 $object->begin_work(@_);
25 return bless {object
=> $object}, $class;
28 sub DESTROY
{ !in_global_destruction
and $_[0]->rollback }
32 Get the object being transacted on
.
36 has 'object', is => 'ro';
42 Commit the transaction
, making updates to the L
</object
> permanent
.
48 return if $self->{done
};
50 my $obj = $self->object;
60 Roll back the transaction
, throwing away any updates to the L
</object
> made since the transaction began
. This
61 happens automatically
when the transaction
is released
, unless it
has already been committed
.
67 return if $self->{done
};
69 my $obj = $self->object;