line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ETL::Yertl::Format::default; |
2
|
|
|
|
|
|
|
our $VERSION = '0.035'; |
3
|
|
|
|
|
|
|
# ABSTRACT: The default format for intra-Yertl communication |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
6
|
|
|
|
|
|
|
#pod |
7
|
|
|
|
|
|
|
#pod my $out_formatter = ETL::Yertl::Format::default->new; |
8
|
|
|
|
|
|
|
#pod print $formatter->write( $document ); |
9
|
|
|
|
|
|
|
#pod |
10
|
|
|
|
|
|
|
#pod my $in_formatter = ETL::Yertl::Format::default->new( |
11
|
|
|
|
|
|
|
#pod input => \*STDIN, |
12
|
|
|
|
|
|
|
#pod ); |
13
|
|
|
|
|
|
|
#pod my $document = $formatter->read; |
14
|
|
|
|
|
|
|
#pod |
15
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
16
|
|
|
|
|
|
|
#pod |
17
|
|
|
|
|
|
|
#pod This is the default format for Yertl programs talking to each other. By |
18
|
|
|
|
|
|
|
#pod default, this is C, but it can be set to C by setting the |
19
|
|
|
|
|
|
|
#pod C environment variable to C<"json">. |
20
|
|
|
|
|
|
|
#pod |
21
|
|
|
|
|
|
|
#pod Setting the default format to something besides YAML can help |
22
|
|
|
|
|
|
|
#pod interoperate with other programs like |
23
|
|
|
|
|
|
|
#pod L or L. |
24
|
|
|
|
|
|
|
#pod |
25
|
|
|
|
|
|
|
#pod =cut |
26
|
|
|
|
|
|
|
|
27
|
15
|
|
|
15
|
|
89138
|
use ETL::Yertl; |
|
15
|
|
|
|
|
33
|
|
|
15
|
|
|
|
|
127
|
|
28
|
15
|
|
|
15
|
|
518
|
use Module::Runtime qw( use_module ); |
|
15
|
|
|
|
|
31
|
|
|
15
|
|
|
|
|
76
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#pod =method new |
31
|
|
|
|
|
|
|
#pod |
32
|
|
|
|
|
|
|
#pod my $formatter = ETL::Yertl::Format::default->new( %args ); |
33
|
|
|
|
|
|
|
#pod |
34
|
|
|
|
|
|
|
#pod Get an instance of the default formatter. The arguments will be passed |
35
|
|
|
|
|
|
|
#pod to the correct formatter module. |
36
|
|
|
|
|
|
|
#pod |
37
|
|
|
|
|
|
|
#pod =cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub new { |
40
|
129
|
|
|
129
|
1
|
3940
|
my ( $class, @args ) = @_; |
41
|
129
|
|
100
|
|
|
619
|
my $format = $ENV{YERTL_FORMAT} || 'yaml'; |
42
|
129
|
|
|
|
|
279
|
my $format_class = "ETL::Yertl::Format::$format"; |
43
|
129
|
|
|
|
|
293
|
return use_module( $format_class )->new( @args ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |