Transactional/TXN/Nested.pm

filter: Statementstmt 88.0% 22 / 25 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod 0.0% 0 / 2 totaltotal 82.0% 32 / 39 CC 3 SCAR 5.9
CC
3
Cov
90%
find_lock
3.0
_build_parent_changed
2.0
_build_all_changed
2.0
CRAP 1.8
« Transactional.pm ↑ Summary Transactional/AutoCommit.pm »
1 #!/usr/bin/perl
2  
3 package Directory::Transactional::TXN::Nested;
4 8 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
5 8 $Directory::Transactional::TXN::Nested::VERSION = '0.09';
6 }
7 8 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 8 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 8 extends qw(Directory::Transactional::TXN);
12  
13 8 has parent => (
14 isa => "Directory::Transactional::TXN",
15 is => "ro",
16 required => 1,
17 );
18  
19 8 ▶sub has_backup { return }
Subroutine has_backup: called CC=1 SCAR=0.0
Pod undocumented
20  
21 has _lock_cache => (
22 isa => "HashRef",
23 is => "ro",
24 8 ▶ default => sub { +{} },
Subroutine __ANON__: called CC=1 SCAR=0.0
25 8 );
26  
27 35 ▶sub find_lock {
Subroutine find_lock: called CC=3 SCAR=11.0
Pod undocumented
28 35 my ( $self, $path ) = @_;
29  
30 35 ▶ if ( my $lock = $self->get_lock($path) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $lock = $self->get_lock($path)) { } 7 28 35
31 7 return $lock;
32 } else {
33 28 my $c = $self->_lock_cache;
34  
35 28 ▶ if ( exists $c->{$path} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $c->{$path}) { } 13 15 28
36 13 return $c->{$path};
37 } else {
38 15 return $c->{$path} = $self->parent->find_lock($path);
39 }
40 }
41 }
42  
43 8 has [qw(parent_changed all_changed)] => (
44 isa => "Set::Object",
45 is => "ro",
46 lazy_build => 1,
47 );
48  
49 0 ▶sub _build_parent_changed {
Subroutine _build_parent_changed: not called CC=1 SCAR=6.9
50 0 shift->parent->all_changed;
51 }
52  
53 0 ▶sub _build_all_changed {
Subroutine _build_all_changed: not called CC=1 SCAR=6.9
54 0 my $self = shift;
55  
56 0 $self->changed->union( $self->parent_changed );
57 }
58  
59 8 __PACKAGE__->meta->make_immutable;
60  
61 8 __PACKAGE__
62  
63 __END__
« Transactional.pm ↑ Summary Transactional/AutoCommit.pm »