]>
Dogcows Code - chaz/p5-File-KDBX/blob - Transaction.pm
10e8b3f6b539fb1bf41425cf9d076d3ff6724f42
1 package File
::KDBX
::Transaction
;
2 # ABSTRACT: Make multiple database edits atomically
7 use Devel
::GlobalDestruction
;
10 our $VERSION = '999.999'; # VERSION
15 my $orig = shift // $object->clone;
16 return bless {object
=> $object, original
=> $orig}, $class;
19 sub DESTROY
{ !in_global_destruction
and $_[0]->rollback }
21 sub object
{ $_[0]->{object
} }
22 sub original
{ $_[0]->{original
} }
26 my $obj = $self->object;
27 if (my $commit = $obj->can('_commit')) {
28 $commit->($obj, $self);
30 $self->{committed
} = 1;
36 return if $self->{committed
};
38 my $obj = $self->object;
39 my $orig = $self->original;
42 @$obj{keys %$orig} = values %$orig;
This page took 0.038016 seconds and 3 git commands to generate.