line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::KDBX::Transaction; |
2
|
|
|
|
|
|
|
# ABSTRACT: Make multiple database edits atomically |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
63
|
|
5
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
37
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
9
|
use Devel::GlobalDestruction; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
16
|
|
8
|
2
|
|
|
2
|
|
134
|
use File::KDBX::Util qw(:class); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
242
|
|
9
|
2
|
|
|
2
|
|
14
|
use namespace::clean; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
15
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.904'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
16
|
|
|
16
|
1
|
25
|
my $class = shift; |
16
|
16
|
|
|
|
|
23
|
my $object = shift; |
17
|
16
|
|
|
|
|
43
|
$object->begin_work(@_); |
18
|
16
|
|
|
|
|
70
|
return bless {object => $object}, $class; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
16
|
50
|
|
16
|
1
|
1691
|
sub DESTROY { !in_global_destruction and $_[0]->rollback } |
|
16
|
50
|
|
16
|
|
48
|
|
22
|
|
|
|
|
|
|
|
23
|
16
|
|
50
|
|
|
47
|
|
24
|
|
|
|
|
|
|
has 'object', is => 'ro'; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub commit { |
28
|
12
|
|
|
12
|
1
|
34
|
my $self = shift; |
29
|
12
|
50
|
|
|
|
33
|
return if $self->{done}; |
30
|
|
|
|
|
|
|
|
31
|
12
|
|
|
|
|
28
|
my $obj = $self->object; |
32
|
12
|
|
|
|
|
47
|
$obj->commit; |
33
|
12
|
|
|
|
|
59
|
$self->{done} = 1; |
34
|
12
|
|
|
|
|
31
|
return $obj; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub rollback { |
39
|
17
|
|
|
17
|
1
|
121
|
my $self = shift; |
40
|
17
|
100
|
|
|
|
65
|
return if $self->{done}; |
41
|
|
|
|
|
|
|
|
42
|
4
|
|
|
|
|
8
|
my $obj = $self->object; |
43
|
4
|
|
|
|
|
15
|
$obj->rollback; |
44
|
4
|
|
|
|
|
14
|
$self->{done} = 1; |
45
|
4
|
|
|
|
|
13
|
return $obj; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |