YAML::P...r::File(3)
πΈ NAME πΈ
okay so this is the YAML::P...r::File(3) page, and the manual name is User Contributed Perl Documentation β folded in near the top like a little name tag π«Ά. The actual name line is YAML::PP::Writer::File - Write YAML output to file or file handle. Slay.
β¨ SYNOPSIS β¨
my $writer = YAML::PP::Writer::File->new(output => $file);
π¦ DESCRIPTION π¦
So YAML::PP::Emitter sends its output to the writer. That's the whole dynamic, bestie.
You can use your own writer if you want to send the YAML output to somewhere else β yes, custom writer era π
. See t/44.writer.t for an example.
π METHODS π
β¨ new β¨
my $writer = YAML::PP::Writer::File->new(output => $file);
my $writer = YAML::PP::Writer::File->new(output => $filehandle);
Constructor. That's it, that's the move π«Ά.
π write π
$writer->write('- ');
π init π
$writer->init;
Initialize β¨.
π¦ finish π¦
$writer->finish;
Gets called when the output ends. If the argument was a filename, the filehandle will be closed. If the argument was a filehandle, the caller needs to close it.
bestie, this is the important bit: filename? the writer closes the filehandle. filehandle? you close it yourself. no cap π.
π output, set_output π
Getter/setter for the YAML output. Periodt π .
byeee π this page is from perl v5.42.0, dated 2026-04-24 β mwah π«Ά
π¦ where this page comes from
- opensuse-leap 16.0: perl-YAML-PP 0.40.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms