line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
1
|
|
|
1
|
|
88156
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
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
|
|
|
|
|
52
|
|
8
|
1
|
|
|
1
|
|
5
|
use Catmandu::Util::Path qw(as_path); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
9
|
1
|
|
|
1
|
|
350
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
10
|
1
|
|
|
1
|
|
5
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
11
|
1
|
|
|
1
|
|
301
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
12
|
1
|
|
|
1
|
|
613
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
12
|
|
13
|
|
|
|
|
|
|
with 'Catmandu::Fix::Builder'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my ($self) = @_; |
18
|
|
|
|
|
|
|
|
19
|
7
|
|
|
7
|
|
47
|
as_path($self->path)->updater( |
20
|
|
|
|
|
|
|
sub { |
21
|
|
|
|
|
|
|
my $val = $_[0]; |
22
|
|
|
|
|
|
|
if (is_string($val)) { |
23
|
6
|
|
|
6
|
|
9
|
"${val}"; |
24
|
6
|
100
|
100
|
|
|
40
|
} |
|
|
100
|
100
|
|
|
|
|
|
|
100
|
|
|
|
|
|
25
|
2
|
|
|
|
|
32
|
elsif (is_array_ref($val) && all {is_value($_)} @$val) { |
26
|
|
|
|
|
|
|
join('', @$val); |
27
|
4
|
|
|
|
|
13
|
} |
28
|
1
|
|
|
|
|
18
|
elsif (is_hash_ref($val) && all {is_value($_)} values %$val) { |
29
|
|
|
|
|
|
|
join('', map {$val->{$_}} sort keys %$val); |
30
|
3
|
|
|
|
|
9
|
} |
31
|
1
|
|
|
|
|
4
|
else { |
|
2
|
|
|
|
|
21
|
|
32
|
|
|
|
|
|
|
''; |
33
|
|
|
|
|
|
|
} |
34
|
2
|
|
|
|
|
34
|
} |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
7
|
|
|
|
|
26
|
} |
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 |