| 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
| |||||||||||
| 31 | 7 | return $lock; | |||||||||
| 32 | } else { | ||||||||||
| 33 | 28 | my $c = $self->_lock_cache; | |||||||||
| 34 | |||||||||||
| 35 | 28 | ▶ | if ( exists $c->{$path} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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__ | ||||||||||