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