| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
|
3
|
120
|
|
|
120
|
|
814
|
|
|
|
120
|
|
|
|
|
216
|
|
|
|
120
|
|
|
|
|
675
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Catmandu::Util qw(is_value is_string require_package); |
|
7
|
120
|
|
|
120
|
|
1133
|
use namespace::clean; |
|
|
120
|
|
|
|
|
250
|
|
|
|
120
|
|
|
|
|
6351
|
|
|
8
|
120
|
|
|
120
|
|
663
|
use Exporter qw(import); |
|
|
120
|
|
|
|
|
215
|
|
|
|
120
|
|
|
|
|
744
|
|
|
9
|
120
|
|
|
120
|
|
29656
|
|
|
|
120
|
|
|
|
|
241
|
|
|
|
120
|
|
|
|
|
30577
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
|
11
|
|
|
|
|
|
|
looks_like_path |
|
12
|
|
|
|
|
|
|
as_path |
|
13
|
|
|
|
|
|
|
); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our %EXPORT_TAGS = (all => \@EXPORT_OK,); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my ($path) = @_; |
|
18
|
|
|
|
|
|
|
is_string($path) && $path =~ /^\$[\.\/]/ ? 1 : 0; |
|
19
|
4
|
|
|
4
|
1
|
7
|
} |
|
20
|
4
|
100
|
66
|
|
|
27
|
|
|
21
|
|
|
|
|
|
|
my ($path, $path_type) = @_; |
|
22
|
|
|
|
|
|
|
if (is_value($path)) { |
|
23
|
|
|
|
|
|
|
$path_type //= 'simple'; |
|
24
|
589
|
|
|
589
|
1
|
1316
|
state $class_cache = {}; |
|
25
|
589
|
50
|
|
|
|
2116
|
my $class = $class_cache->{$path_type} |
|
26
|
589
|
|
50
|
|
|
2627
|
||= require_package($path_type, 'Catmandu::Path'); |
|
27
|
589
|
|
|
|
|
853
|
$class->new(path => $path); |
|
28
|
589
|
|
66
|
|
|
2213
|
} |
|
29
|
|
|
|
|
|
|
else { |
|
30
|
589
|
|
|
|
|
7982
|
$path; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
} |
|
33
|
0
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=pod |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Catmandu::Util::Path - Path related utility functions |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 FUNCTIONS |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=over 4 |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=item looks_like_path($str) |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Returns 1 if the given string is a path, 0 otherwise. Only recognizes |
|
50
|
|
|
|
|
|
|
L<Catmandu::Path::simple> paths prefixed with a dollar sign at the moment. |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
looks_like_path("$.foo.bar.$append") |
|
53
|
|
|
|
|
|
|
# => 1 |
|
54
|
|
|
|
|
|
|
looks_like_path("waffles") |
|
55
|
|
|
|
|
|
|
# => 0 |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=item as_path($str, $type) |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Helper function that returns a L<Catmandu::Path> instance for the given path |
|
60
|
|
|
|
|
|
|
string. The optional C<$type> argument gives preliminary support for |
|
61
|
|
|
|
|
|
|
alternative path implementations and defaults to 'simple'. |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
as_path("$.foo.bar.$append") |
|
64
|
|
|
|
|
|
|
# is equivalent to |
|
65
|
|
|
|
|
|
|
Catmandu::Path::simple->new(path => "$.foo.bar.$append"); |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=back |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |