YAML::PP::Emitter(3) User Contributed Perl Documentation YAML::PP::Emitter(3)

YAML::PP::Emitter - Emitting events

my $emitter = YAML::PP::Emitter->new(
    indent => 4,
$emitter->document_start_event({ implicit => 1 });
$emitter->scalar_event({ value => $input, style => $style });
$emitter->document_end_event({ implicit => 1 });
my $yaml = $emitter->writer->output;

The emitter emits events to YAML. It provides methods for each event type. The arguments are mostly the same as the events from YAML::PP::Parser.

my $emitter = YAML::PP::Emitter->new(
    indent => 4,

Constructor. Currently takes these options:

Getter/setter for number of indentation spaces.

TODO: Currently sequences are always zero-indented.

Getter/setter for the writer object. By default YAML::PP::Writer. You can pass your own writer if you want to output the resulting YAML yourself.
2022-11-12 perl v5.36.0