1YAML::PP::Emitter(3) User Contributed Perl Documentation YAML::PP::Emitter(3)
2
3
4
6 YAML::PP::Emitter - Emitting events
7
9 my $emitter = YAML::PP::Emitter->new(
10 indent => 4,
11 );
12
13 $emitter->init;
14
15 $emitter->stream_start_event;
16 $emitter->document_start_event({ implicit => 1 });
17 $emitter->sequence_start_event;
18 $emitter->scalar_event({ value => $input, style => $style });
19 $emitter->sequence_end_event;
20 $emitter->document_end_event({ implicit => 1 });
21 $emitter->stream_end_event;
22
23 my $yaml = $emitter->writer->output;
24 $emitter->finish;
25
27 The emitter emits events to YAML. It provides methods for each event
28 type. The arguments are mostly the same as the events from
29 YAML::PP::Parser.
30
32 new
33 my $emitter = YAML::PP::Emitter->new(
34 indent => 4,
35 );
36
37 Constructor. Currently takes these options:
38
39 indent
40 writer
41 stream_start_event, stream_end_event, document_start_event,
42 document_end_event, sequence_start_event, sequence_end_event,
43 mapping_start_event, mapping_end_event, scalar_event, alias_event
44 indent, set_indent
45 Getter/setter for number of indentation spaces.
46
47 TODO: Currently sequences are always zero-indented.
48
49 writer, set_writer
50 Getter/setter for the writer object. By default YAML::PP::Writer.
51 You can pass your own writer if you want to output the resulting
52 YAML yourself.
53
54 init
55 Initialize
56
57 finish
58
59
60
61perl v5.34.0 2022-01-21 YAML::PP::Emitter(3)