line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
1
|
|
|
1
|
|
88524
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
1
|
|
|
1
|
|
7
|
use Catmandu::Util::Path qw(as_path); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
8
|
1
|
|
|
1
|
|
782
|
use Catmandu; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
9
|
1
|
|
|
1
|
|
401
|
use namespace::clean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
10
|
1
|
|
|
1
|
|
199
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
11
|
1
|
|
|
1
|
|
667
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
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
|
|
47
|
my $opts = $self->opts; |
21
|
6
|
|
|
|
|
15
|
as_path($self->path)->updater( |
22
|
6
|
|
|
|
|
38
|
if => [ |
23
|
|
|
|
|
|
|
[qw(array_ref hash_ref)] => |
24
|
|
|
|
|
|
|
sub {Catmandu->export_to_string($_[0], $name, %$opts)} |
25
|
|
|
|
|
|
|
] |
26
|
6
|
|
|
6
|
|
38
|
); |
27
|
6
|
|
|
|
|
23
|
} |
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
|
|
|
|
|
|
|
|