line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
94
|
|
|
94
|
|
43624
|
|
|
94
|
|
|
|
|
203
|
|
|
94
|
|
|
|
|
615
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Catmandu::Util qw(is_array_ref is_code_ref); |
7
|
94
|
|
|
94
|
|
629
|
use Moo::Role; |
|
94
|
|
|
|
|
204
|
|
|
94
|
|
|
|
|
4284
|
|
8
|
94
|
|
|
94
|
|
490
|
|
|
94
|
|
|
|
|
169
|
|
|
94
|
|
|
|
|
598
|
|
9
|
|
|
|
|
|
|
has path => (is => 'ro', required => 1); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
requires 'getter'; |
12
|
|
|
|
|
|
|
requires 'setter'; |
13
|
|
|
|
|
|
|
requires 'creator'; |
14
|
|
|
|
|
|
|
requires 'updater'; |
15
|
|
|
|
|
|
|
requires 'deleter'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
around creator => sub { |
18
|
|
|
|
|
|
|
my $orig = shift; |
19
|
|
|
|
|
|
|
my $self = shift; |
20
|
|
|
|
|
|
|
my %opts = @_ == 1 ? (value => $_[0]) : @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
$orig->($self, %opts); |
23
|
|
|
|
|
|
|
}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
around updater => sub { |
26
|
|
|
|
|
|
|
my $orig = shift; |
27
|
|
|
|
|
|
|
my $self = shift; |
28
|
|
|
|
|
|
|
my %opts = @_ == 1 ? (value => $_[0]) : @_; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
for my $key (keys %opts) { |
31
|
|
|
|
|
|
|
my $val = $opts{$key}; |
32
|
|
|
|
|
|
|
next unless $key =~ s/^if_//; |
33
|
|
|
|
|
|
|
push @{$opts{if} ||= []}, $key, $val; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
if (my $tests = $opts{if}) { |
37
|
|
|
|
|
|
|
for (my $i = 0; $i < @$tests; $i += 2) { |
38
|
|
|
|
|
|
|
my $test = $tests->[$i]; |
39
|
|
|
|
|
|
|
$test = [$test] unless is_array_ref($test); |
40
|
|
|
|
|
|
|
$tests->[$i] |
41
|
|
|
|
|
|
|
= [map {is_code_ref($_) ? $_ : Catmandu::Util->can("is_$_")} |
42
|
|
|
|
|
|
|
@$test]; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$orig->($self, %opts); |
47
|
|
|
|
|
|
|
}; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=pod |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 NAME |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Catmandu::Path - Base role for Catmandu path implementations |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SEE ALSO |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
L<Catmandu::Path::simple>. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |