| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package ETL::Yertl::Format::default; |
|
2
|
|
|
|
|
|
|
our $VERSION = '0.037'; |
|
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
|
17
|
|
|
17
|
|
92620
|
use ETL::Yertl; |
|
|
17
|
|
|
|
|
36
|
|
|
|
17
|
|
|
|
|
166
|
|
|
28
|
17
|
|
|
17
|
|
586
|
use Module::Runtime qw( use_module ); |
|
|
17
|
|
|
|
|
29
|
|
|
|
17
|
|
|
|
|
113
|
|
|
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
|
166
|
|
|
166
|
1
|
3687
|
my ( $class, @args ) = @_; |
|
41
|
166
|
|
100
|
|
|
786
|
my $format = $ENV{YERTL_FORMAT} || 'yaml'; |
|
42
|
166
|
|
|
|
|
346
|
my $format_class = "ETL::Yertl::Format::$format"; |
|
43
|
166
|
|
|
|
|
366
|
return use_module( $format_class )->new( @args ); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |