Blast-Radius Aware AI Code Review for Business-Critical Systems
LiveReview LiveReview Explore LiveReview

Catmandu::Exporter::YAML - a YAML exporter

Configuration

       file
           Write  output to a local file given by its path or file handle.  Alternatively a scalar reference can
           be passed to write to a string and a code reference can be used to write to a callback function.

       fh  Write the output to an IO::Handle. If not specified, Catmandu::Util::io is used to create the  output
           handle from the "file" argument or by using STDOUT.

       fix An ARRAY of one or more fixes or file scripts to be applied to exported items.

       encoding
           Binmode of the output stream "fh". Set to "":utf8"" by default.

Name

       Catmandu::Exporter::YAML - a YAML exporter

See Also

       Catmandu::Exporter, Catmandu::Importer::YAML

perl v5.40.0                                       2025-01-17                      Catmandu::Exporter::YAML(3pm)

Synopsis

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

           # 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;

See Also