line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::split_field; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
106481
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.2020'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
8
|
1
|
|
|
1
|
|
816
|
use Catmandu::Util::Path qw(as_path); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
52
|
|
9
|
1
|
|
|
1
|
|
7
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
10
|
1
|
|
|
1
|
|
695
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
13
|
|
|
|
|
|
|
has split_char => (fix_arg => 1, default => sub {qr'\s+'}); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
with 'Catmandu::Fix::Builder'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub _build_fixer { |
18
|
3
|
|
|
3
|
|
25
|
my ($self) = @_; |
19
|
3
|
|
|
|
|
9
|
my $split_char = $self->split_char; |
20
|
|
|
|
|
|
|
as_path($self->path) |
21
|
3
|
|
|
3
|
|
14
|
->updater(if_value => sub {[split $split_char, $_[0]]}); |
|
3
|
|
|
|
|
102
|
|
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__END__ |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=pod |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 NAME |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Catmandu::Fix::split_field - split a string value in a field into an ARRAY |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Split the 'foo' value into an array. E.g. foo => '1:2:3' |
37
|
|
|
|
|
|
|
split_field(foo, ':') # foo => [1,2,3] |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 SEE ALSO |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
L<Catmandu::Fix> |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |