Catman...::Text(3pm)

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

πŸ’– NAME πŸ’–

Catmandu::Exporter::Text β€” a Text exporter, bestie πŸ’…

(and yeah, this whole page is straight out of the User Contributed Perl Documentation for Catman...::Text(3pm), okurrr)


✨ SYNOPSIS ✨

# From the command line

# Write all field values as a line of Text
$ catmandu convert JSON to Text --field_sep "," < data.json

# In a Perl script

use Catmandu;

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

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

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

$exporter->add($hashref);

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

🌸 DESCRIPTION 🌸

okay so this Catmandu::Exporter is literally the chillest one β€” it exports items as raw text. every single field value it finds in your data gets glued together, and field_sep is the lil delimiter doing the gluing. no cap. 🫢


πŸŽ€ CONFIGURATION πŸŽ€

  • file β€” write your output to a local file, and you can hand it over either by its path or by a file handle. OR (plot twist ✨) you can pass a scalar reference to write to a string, or a code reference to write to a callback function. iconic behavior honestly.
  • fh β€” write the output to an IO::Handle. if you don't specify one, Catmandu::Util::io gets called in to make the output handle from the file argument, or it just falls back to STDOUT. slay.
  • fix β€” an ARRAY of one or more fixes or file scripts that get applied to the exported items. yes bestie, plural, stack 'em πŸ’…
  • encoding β€” the binmode of the output stream fh. defaults to ":utf8" out of the box. cute.
  • line_sep STR β€” use STR at each end of line. defaults to "\n" and honestly? same.
  • field_sep STR β€” use STR at each end of a field. (this is the one from the SYNOPSIS, remember --field_sep ","? yeah, her. πŸ‘‘)

πŸ¦‹ SEE ALSO πŸ¦‹

  • Catmandu::Exporter
  • Catmandu::Importer::Text

lowkey go read those two if you wanna complete the vibe, iykyk πŸ’œ

mwah πŸ’‹ that's the whole page. this was perl v5.40.1, dated 2026-01-24, and it's the Catman...::Text(3pm) era β€” thanks for reading to the end, bestie, you ate that fr fr πŸ“βœ¨

πŸ“¦ where this page comes from