Catman...::YAML(3pm)

πŸ“¦
version 1.2025 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– Catmandu::Exporter::YAML πŸ’–

okay bestie, so this page is from the Catman...::YAML(3pm) section of the manual β€” and no cap, it's the whole tea on Catmandu::Exporter::YAML, aka a YAML exporter. she exports YAML. that's the vibe. πŸŽ€


✨ NAME ✨

Catmandu::Exporter::YAML β€” a YAML exporter πŸ¦‹


✨ SYNOPSIS ✨

lowkey the fastest way to get it? straight from the commandline, bestie:

# From the commandline
$ catmandu convert JSON --fix myfixes to YAML < /tmp/data.json

or if you're a Perl girlie (and you ARE, iykyk):

# From Perl

use Catmandu;

# Print to STDOUT
my $exporter = Catmandu->exporter('YAML', fix => 'myfix.txt');

# Print to file or IO::Handle
my $exporter = Catmandu->exporter('YAML', file => '/tmp/out.yml');
my $exporter = Catmandu->exporter('YAML', file => $fh);

$exporter->add_many($arrayref);
$exporter->add_many($iterator);
$exporter->add_many(sub { });

$exporter->add($hashref);

printf "exported %d items\n" , $exporter->count;

like... add_many with an arrayref, with an iterator, with a sub β€” she takes them ALL. main character energy honestly. πŸ‘‘


✨ CONFIGURATION ✨

the options, the moment, the slay:

  • file β€” write that output to a local file, given by its path or a file handle. OR, plot twist πŸ’…, you can pass a scalar reference to write into a string, or a code reference to write to a callback function. versatile icon.
  • fh β€” write the output to an IO::Handle. if you don't specify it, Catmandu::Util::io is used to create the output handle from the "file" argument, or by using STDOUT. she figures it out, don't worry. ✨
  • fix β€” an ARRAY of one or more fixes, or file scripts, to be applied to exported items. glow-up those items before they leave the house. 🧚
  • encoding β€” the binmode of the output stream "fh". set to ":utf8" by default, as she should. 🫢

✨ SEE ALSO ✨

go read these too, bestie, they're part of the family:

  • Catmandu::Exporter
  • Catmandu::Importer::YAML

okay that's the whole page, no crumbs left. πŸ’œ this lil manual moment was served up by perl v5.40.1 on 2026-01-24, and it lives in the Catman...::YAML(3pm) section. periodt. 🌈⭐

πŸ“¦ where this page comes from