1TAP::Parser::YAMLish::WUrsietrerC(o3n)tributed Perl DocuTmAePn:t:aPtairosner::YAMLish::Writer(3)
2
3
4

NAME

6       TAP::Parser::YAMLish::Writer - Write YAMLish data
7

VERSION

9       Version 3.42
10

SYNOPSIS

12           use TAP::Parser::YAMLish::Writer;
13
14           my $data = {
15               one => 1,
16               two => 2,
17               three => [ 1, 2, 3 ],
18           };
19
20           my $yw = TAP::Parser::YAMLish::Writer->new;
21
22           # Write to an array...
23           $yw->write( $data, \@some_array );
24
25           # ...an open file handle...
26           $yw->write( $data, $some_file_handle );
27
28           # ...a string ...
29           $yw->write( $data, \$some_string );
30
31           # ...or a closure
32           $yw->write( $data, sub {
33               my $line = shift;
34               print "$line\n";
35           } );
36

DESCRIPTION

38       Encodes a scalar, hash reference or array reference as YAMLish.
39

METHODS

41   Class Methods
42       "new"
43
44        my $writer = TAP::Parser::YAMLish::Writer->new;
45
46       The constructor "new" creates and returns an empty
47       "TAP::Parser::YAMLish::Writer" object.
48
49   Instance Methods
50       "write"
51
52        $writer->write($obj, $output );
53
54       Encode a scalar, hash reference or array reference as YAML.
55
56           my $writer = sub {
57               my $line = shift;
58               print SOMEFILE "$line\n";
59           };
60
61           my $data = {
62               one => 1,
63               two => 2,
64               three => [ 1, 2, 3 ],
65           };
66
67           my $yw = TAP::Parser::YAMLish::Writer->new;
68           $yw->write( $data, $writer );
69
70       The  $output  argument may be:
71
72       ·   a reference to a scalar to append YAML to
73
74       ·   the handle of an open file
75
76       ·   a reference to an array into which YAML will be pushed
77
78       ·   a code reference
79
80       If you supply a code reference the subroutine will be called once for
81       each line of output with the line as its only argument. Passed lines
82       will have no trailing newline.
83

AUTHOR

85       Andy Armstrong, <andy@hexten.net>
86

SEE ALSO

88       YAML::Tiny, YAML, YAML::Syck, Config::Tiny, CSS::Tiny,
89       <http://use.perl.org/~Alias/journal/29427>
90
92       Copyright 2007-2011 Andy Armstrong.
93
94       This program is free software; you can redistribute it and/or modify it
95       under the same terms as Perl itself.
96
97       The full text of the license can be found in the LICENSE file included
98       with this module.
99
100
101
102perl v5.28.1                      2018-03-19   TAP::Parser::YAMLish::Writer(3)
Impressum