TAP::P...Writer(3perl)

✨ TAP::Parser::YAMLish::Writer ✨

okay bestie, gather round πŸ’– this is a page from the Perl Programmers Reference Guide about TAP::Parser::YAMLish::Writer β€” yes that's the whole name, it's a mouthful, we love it anyway πŸŽ€

Version: 3.52 πŸ‘‘


🌸 SYNOPSIS 🌸

use TAP::Parser::YAMLish::Writer;

my $data = {
    one => 1,
    two => 2,
    three => [ 1, 2, 3 ],
};

my $yw = TAP::Parser::YAMLish::Writer->new;

# Write to an array...
$yw->write( $data, \@some_array );

# ...an open file handle...
$yw->write( $data, $some_file_handle );

# ...a string ...
$yw->write( $data, \$some_string );

# ...or a closure
$yw->write( $data, sub {
    my $line = shift;
    print "$line\n";
} );

like, five different ways to yeet your data out the door and every single one of them slays πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

It takes a scalar, or a hash reference, or an array reference, and encodes it as YAMLish. that's the whole vibe. no notes ✨


πŸ’œ METHODS πŸ’œ

🌈 Class Methods 🌈

new

my $writer = TAP::Parser::YAMLish::Writer->new;

The constructor new makes you a brand new TAP::Parser::YAMLish::Writer object, fresh out the box, empty and ready to go 🫢 it creates it and hands it right back to you, periodt.

🌟 Instance Methods 🌟

write

$writer->write($obj, $output );

Encode a scalar, hash reference or array reference as YAML. ngl that's the main character move of this whole module πŸ‘‘

my $writer = sub {
    my $line = shift;
    print SOMEFILE "$line\n";
};

my $data = {
    one => 1,
    two => 2,
    three => [ 1, 2, 3 ],
};

my $yw = TAP::Parser::YAMLish::Writer->new;
$yw->write( $data, $writer );

The $output argument may be:

  • a reference to a scalar to append YAML to πŸ’–
  • the handle of an open file πŸŽ€
  • a reference to an array into which YAML will be pushed πŸ¦‹
  • a code reference 🌸

If you supply a code reference the subroutine will be called once for each line of output with the line as its only argument. heads up: passed lines will have no trailing newline β€” so if you want one, you gotta add it yourself, bestie 😭 that's on you fr fr.


⭐ AUTHOR ⭐

Andy Armstrong, <andy@hexten.net>


πŸ’€ SEE ALSO πŸ’€

YAML::Tiny, YAML, YAML::Syck, Config::Tiny, CSS::Tiny, <http://use.perl.org/~Alias/journal/29427>

go read those too, iykyk πŸ“šβœ¨


Copyright 2007-2011 Andy Armstrong.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module. πŸŽ€


okay that's the whole page, no cap πŸ’– this was perl v5.44.0, dated 2026-10-17, and yeah the header really does abbreviate it to TAP::P...Writer(3perl) like it's too cool to finish the word 😭 iconic honestly, bye bestie 🫢🌸

πŸ“¦ where this page comes from
  • arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms