line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
1
|
|
|
1
|
|
87923
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use List::Util qw(all); |
7
|
1
|
|
|
1
|
|
7
|
use Catmandu::Util qw(is_string is_value is_array_ref is_hash_ref); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
8
|
1
|
|
|
1
|
|
5
|
use Catmandu::Util::Path qw(as_path); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
9
|
1
|
|
|
1
|
|
375
|
use Moo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
10
|
1
|
|
|
1
|
|
5
|
use namespace::clean; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
11
|
1
|
|
|
1
|
|
321
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
12
|
1
|
|
|
1
|
|
626
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
13
|
|
13
|
|
|
|
|
|
|
with 'Catmandu::Fix::Builder'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my ($self) = @_; |
18
|
|
|
|
|
|
|
|
19
|
7
|
|
|
7
|
|
46
|
as_path($self->path)->updater( |
20
|
|
|
|
|
|
|
sub { |
21
|
|
|
|
|
|
|
my $val = $_[0]; |
22
|
|
|
|
|
|
|
if (is_string($val)) { |
23
|
6
|
|
|
6
|
|
8
|
"${val}"; |
24
|
6
|
100
|
100
|
|
|
39
|
} |
|
|
100
|
100
|
|
|
|
|
|
|
100
|
|
|
|
|
|
25
|
2
|
|
|
|
|
31
|
elsif (is_array_ref($val) && all {is_value($_)} @$val) { |
26
|
|
|
|
|
|
|
join('', @$val); |
27
|
4
|
|
|
|
|
15
|
} |
28
|
1
|
|
|
|
|
18
|
elsif (is_hash_ref($val) && all {is_value($_)} values %$val) { |
29
|
|
|
|
|
|
|
join('', map {$val->{$_}} sort keys %$val); |
30
|
4
|
|
|
|
|
10
|
} |
31
|
1
|
|
|
|
|
4
|
else { |
|
2
|
|
|
|
|
21
|
|
32
|
|
|
|
|
|
|
''; |
33
|
|
|
|
|
|
|
} |
34
|
2
|
|
|
|
|
32
|
} |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
7
|
|
|
|
|
23
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=pod |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Catmandu::Fix::string - convert a value to a string |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SYNOPSIS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# year => 2016 |
51
|
|
|
|
|
|
|
string(year) |
52
|
|
|
|
|
|
|
# year => "2016" |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# foo => ["a", "b", "c"] |
55
|
|
|
|
|
|
|
string(foo) |
56
|
|
|
|
|
|
|
# foo => "abc" |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# foo => ["a", {b => "c"}, "d"] |
59
|
|
|
|
|
|
|
string(foo) |
60
|
|
|
|
|
|
|
# foo => "" |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# foo => {2 => "b", 1 => "a"} |
63
|
|
|
|
|
|
|
string(foo) |
64
|
|
|
|
|
|
|
# foo => "ab" |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# foo => {a => ["b"]} |
67
|
|
|
|
|
|
|
string(foo) |
68
|
|
|
|
|
|
|
# foo => "" |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 SEE ALSO |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
L<Catmandu::Fix> |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |