| 1 | package Catmandu::Path; | ||||||||||||
| 2 | |||||||||||||
| 3 | 95 | ▶ | use Catmandu::Sane; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | |||||||||||||
| 5 | 95 | our $VERSION = '1.2025'; | |||||||||||
| 6 | |||||||||||||
| 7 | 95 | ▶ | use Catmandu::Util qw(is_array_ref is_code_ref); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 95 | ▶ | use Moo::Role; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 95 | has path => (is => 'ro', required => 1); | |||||||||||
| 11 | |||||||||||||
| 12 | 95 | requires 'getter'; | |||||||||||
| 13 | 95 | requires 'setter'; | |||||||||||
| 14 | 95 | requires 'creator'; | |||||||||||
| 15 | 95 | requires 'updater'; | |||||||||||
| 16 | 95 | requires 'deleter'; | |||||||||||
| 17 | |||||||||||||
| 18 | 201 | ▶ | around creator => sub { | ||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||
| 19 | 201 | my $orig = shift; | |||||||||||
| 20 | 201 | my $self = shift; | |||||||||||
| 21 | 201 | ▶ | my %opts = @_ == 1 ? (value => $_[0]) : @_; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 22 | |||||||||||||
| 23 | 201 | $orig->($self, %opts); | |||||||||||
| 24 | 95 | }; | |||||||||||
| 25 | |||||||||||||
| 26 | 151 | ▶ | around updater => sub { | ||||||||||
|
Subroutine
__ANON__: called CC=9 SCAR=22.0
| |||||||||||||
| 27 | 151 | my $orig = shift; | |||||||||||
| 28 | 151 | my $self = shift; | |||||||||||
| 29 | 151 | ▶ | my %opts = @_ == 1 ? (value => $_[0]) : @_; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 30 | |||||||||||||
| 31 | 151 | for my $key (keys %opts) { | |||||||||||
| 32 | 164 | my $val = $opts{$key}; | |||||||||||
| 33 | 164 | ▶ | next unless $key =~ s/^if_//; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 34 | 112 | ▶ | push @{$opts{if} ||= []}, $key, $val; | ||||||||||
|
Condition100%2/2
$opts{"if"} ||= []
MC/DC100%1/1
$opts{"if"} ||= []
$opts{"if"}
Truth table100%2/2
A
A= $opts{"if"}
| |||||||||||||
| 35 | } | ||||||||||||
| 36 | |||||||||||||
| 37 | 151 | ▶ | if (my $tests = $opts{if}) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 38 | 111 | ▶ | for (my $i = 0; $i < @$tests; $i += 2) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 39 | 128 | my $test = $tests->[$i]; | |||||||||||
| 40 | 128 | ▶ | $test = [$test] unless is_array_ref($test); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 41 | $tests->[$i] | ||||||||||||
| 42 | 128 | ▶ | = [map {is_code_ref($_) ? $_ : Catmandu::Util->can("is_$_")} | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 43 | @$test]; | ||||||||||||
| 44 | } | ||||||||||||
| 45 | } | ||||||||||||
| 46 | |||||||||||||
| 47 | 151 | $orig->($self, %opts); | |||||||||||
| 48 | 95 | }; | |||||||||||
| 49 | |||||||||||||
| 50 | 95 | 1; | |||||||||||
| 51 | |||||||||||||
| 52 | __END__ | ||||||||||||