KDBX/Transaction.pm

filter: Statementstmt 100% 37 / 37 Branchbran 62.5% 5 / 8 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 10 / 10 Podpod 100% 4 / 4 totaltotal 91.9% 57 / 62 CC 6 SCAR 6.4
CC
6
Cov
91%
object
3.3
DESTROY
2.1
commit
2.0
CRAP 1.9
« KDBX/Constants.pm ↑ Summary KDBX/Dumper/Raw.pm »
1 package File::KDBX::Transaction;
2 # ABSTRACT: Make multiple database edits atomically
3  
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use Devel::GlobalDestruction;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use File::KDBX::Util qw(:class);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 our $VERSION = '0.905'; # VERSION
12  
13  
14 sub new {
15 16 ▶ my $class = shift;
Subroutine new: called CC=1 SCAR=0.0
Pod documented
16 16 my $object = shift;
17 16 $object->begin_work(@_);
18 16 return bless {object => $object}, $class;
19 }
20  
21 16 ▶sub DESTROY { !in_global_destruction and $_[0]->rollback }
Subroutine DESTROY: called CC=2 SCAR=7.6
Subroutine object: called CC=3 SCAR=12.0
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
not &in_global_destruction() and $_[0]->rollback 16 0 16
unless builtin::blessed($_[0]) 0 16 16
22  
23 16 ▶ 
Condition50%1/2
$_[0]{"object"} //= undef
l!l
160
MC/DC0%0/1
$_[0]{"object"} //= undef
$_[0]{"object"}
Truth table50%1/2
A
A= $_[0]{"object"}
Aresult
11
00
24 3 has 'object', is => 'ro';
25  
26  
27 sub commit {
28 12 ▶ my $self = shift;
Subroutine commit: called CC=2 SCAR=7.0
Pod documented
29 12 ▶ return if $self->{done};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"done"} 0 12 12
30  
31 12 my $obj = $self->object;
32 12 $obj->commit;
33 12 $self->{done} = 1;
34 12 return $obj;
35 }
36  
37  
38 sub rollback {
39 17 ▶ my $self = shift;
Subroutine rollback: called CC=2 SCAR=6.9
Pod documented
40 17 ▶ return if $self->{done};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"done"} 13 4 17
41  
42 4 my $obj = $self->object;
43 4 $obj->rollback;
44 4 $self->{done} = 1;
45 4 return $obj;
46 }
47  
48 3 1;
49  
50 __END__
« KDBX/Constants.pm ↑ Summary KDBX/Dumper/Raw.pm »