line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
4
|
|
|
4
|
|
27
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
126
|
|
2
|
4
|
|
|
4
|
|
20
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
176
|
|
3
|
|
|
|
|
|
|
package Data::Hive::PathPacker::Strict 1.014; |
4
|
|
|
|
|
|
|
# ABSTRACT: a simple, strict path packer |
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
21
|
use parent 'Data::Hive::PathPacker'; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
21
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
178
|
use Carp (); |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
784
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
11
|
|
|
|
|
|
|
#pod |
12
|
|
|
|
|
|
|
#pod The Strict path packer is the simplest useful implementation of |
13
|
|
|
|
|
|
|
#pod L. It joins path parts together with a fixed string |
14
|
|
|
|
|
|
|
#pod and splits them apart on the same string. If the fixed string occurs any path |
15
|
|
|
|
|
|
|
#pod part, an exception is thrown. |
16
|
|
|
|
|
|
|
#pod |
17
|
|
|
|
|
|
|
#pod =method new |
18
|
|
|
|
|
|
|
#pod |
19
|
|
|
|
|
|
|
#pod my $packer = Data::Hive::PathPacker::Strict->new( \%arg ); |
20
|
|
|
|
|
|
|
#pod |
21
|
|
|
|
|
|
|
#pod The only valid argument is C, which is the string used to join path |
22
|
|
|
|
|
|
|
#pod parts. It defaults to a single period. |
23
|
|
|
|
|
|
|
#pod |
24
|
|
|
|
|
|
|
#pod =cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new { |
27
|
16
|
|
|
16
|
1
|
33
|
my ($class, $arg) = @_; |
28
|
16
|
|
50
|
|
|
77
|
$arg ||= {}; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $guts = { |
31
|
16
|
|
50
|
|
|
67
|
separator => $arg->{separator} || '.', |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
|
34
|
16
|
|
|
|
|
144
|
return bless $guts => $class; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub pack_path { |
38
|
161
|
|
|
161
|
1
|
274
|
my ($self, $path) = @_; |
39
|
|
|
|
|
|
|
|
40
|
161
|
|
|
|
|
272
|
my $sep = $self->{separator}; |
41
|
161
|
|
|
|
|
263
|
my @illegal = grep { /\Q$sep\E/ } @$path; |
|
363
|
|
|
|
|
1167
|
|
42
|
|
|
|
|
|
|
|
43
|
161
|
100
|
|
|
|
571
|
Carp::confess("illegal hive path parts: @illegal") if @illegal; |
44
|
|
|
|
|
|
|
|
45
|
160
|
|
|
|
|
858
|
return join $sep, @$path; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub unpack_path { |
49
|
266
|
|
|
266
|
1
|
476
|
my ($self, $str) = @_; |
50
|
|
|
|
|
|
|
|
51
|
266
|
|
|
|
|
366
|
my $sep = $self->{separator}; |
52
|
266
|
|
|
|
|
974
|
return [ split /\Q$sep\E/, $str ]; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |