line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
1
|
|
|
1
|
|
93244
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
1
|
|
|
1
|
|
7
|
use Catmandu::Util::Path qw(as_path); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
8
|
1
|
|
|
1
|
|
786
|
use Catmandu; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
47
|
|
9
|
1
|
|
|
1
|
|
410
|
use namespace::clean; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
5
|
|
10
|
1
|
|
|
1
|
|
249
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
11
|
1
|
|
|
1
|
|
828
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
12
|
|
|
|
|
|
|
with 'Catmandu::Fix::Builder'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
15
|
|
|
|
|
|
|
has name => (fix_arg => 1); |
16
|
|
|
|
|
|
|
has opts => (fix_opt => 'collect'); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my ($self) = @_; |
19
|
|
|
|
|
|
|
my $name = $self->name; |
20
|
6
|
|
|
6
|
|
57
|
my $opts = $self->opts; |
21
|
6
|
|
|
|
|
17
|
as_path($self->path)->updater( |
22
|
6
|
|
|
|
|
46
|
if => [ |
23
|
|
|
|
|
|
|
[qw(array_ref hash_ref)] => |
24
|
|
|
|
|
|
|
sub {Catmandu->export_to_string($_[0], $name, %$opts)} |
25
|
|
|
|
|
|
|
] |
26
|
6
|
|
|
6
|
|
51
|
); |
27
|
6
|
|
|
|
|
36
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=pod |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 NAME |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Catmandu::Fix::export_to_string - convert the value of field using a named exporter |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 SYNOPSIS |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
export_to_string(my.field,'YAML') |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
export_to_string(my.field2,'JSON') |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
export_to_string(my.field3,'CSV', 'sep_char' => ';' ) |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 DESCRIPTION |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 export_string( PATH, NAME [, EXPORT_OPTIONS ] ) |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This fix uses the function export_to_string of the package L<Catmandu>, but requires the NAME of the exporter. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
It expects a HASH or ARRAY as input. Other values are silently ignored. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=over 4 |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item PATH |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item NAME |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
name of the exporter to use. As usual in Catmandu, one can choose: |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
* full package name of the exporter (e.g. 'Catmandu::Exporter::JSON') |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
* short package name of the exporter (e.g. 'JSON') |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
* name of the exporter as declared in the Catmandu configuration |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item EXPORT_OPTIONS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
extra options for the named exporter |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=back |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 AUTHOR |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Nicolas Franck, C<< <nicolas.franck at ugent.be> >> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 SEE ALSO |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
L<Catmandu::Fix> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
83
|
|
|
|
|
|
|
|