| 1 | package Dist::Conformance::Snapshot::Tree 0.006; | ||||||||||||
| 2 | |||||||||||||
| 3 | # ABSTRACT: A snapshot from a tree listing and a callback that fetches one file | ||||||||||||
| 4 | |||||||||||||
| 5 | 1 | ▶ | use 5.040; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 1 | ▶ | use warnings FATAL => 'all'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 1 | ▶ | use re '/aasx'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 1 | ▶ | use Mojo::Base 'Dist::Conformance::Snapshot', -signatures; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | |||||||||||||
| 11 | 1 | has 'paths'; | |||||||||||
| 12 | 1 | has 'fetch'; | |||||||||||
| 13 | |||||||||||||
| 14 | |||||||||||||
| 15 | 0 | ▶ | sub new ( $class, @args ) { | ||||||||||
|
Subroutine
new: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||
| 16 | 0 | my $self = $class->SUPER::new(@args); | |||||||||||
| 17 | 0 | ▶ | die "paths must be a hash reference of path => blob SHA\n" if ref $self->paths ne 'HASH'; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 18 | 0 | ▶ | die "fetch must be a code reference\n" if ref $self->fetch ne 'CODE'; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 19 | 0 | return $self; | |||||||||||
| 20 | } | ||||||||||||
| 21 | |||||||||||||
| 22 | |||||||||||||
| 23 | 0 | ▶ | sub content ( $self, $path ) { | ||||||||||
|
Subroutine
content: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||
| 24 | 0 | ▶ | return undef if !$self->contains($path); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 25 | 0 | ▶ | my $fetched = $self->{fetched} //= {}; | ||||||||||
|
Condition0%0/2
$self->{"fetched"} //= {}
MC/DC0%0/1
$self->{"fetched"} //= {}
$self->{"fetched"}
Truth table0%0/2
A
A= $self->{"fetched"}
| |||||||||||||
| 26 | 0 | ▶ | $fetched->{$path} = $self->fetch->($path) if !exists $fetched->{$path}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 27 | 0 | return $fetched->{$path}; | |||||||||||
| 28 | } | ||||||||||||
| 29 | |||||||||||||
| 30 | __END__ | ||||||||||||