Catman...porter(3pm)
π Catman...porter π
okay bestie, buckle up, this is a Perl module page, section 3pm, and it's the one and only Catmandu::Fix::add_to_exporter β¨
π NAME π
Catmandu::Fix::add_to_exporter β exports a record as a side effect π
like, it doesn't just fix your data, it also yeets a copy of it out to a file while it's at it. multitasking queen behavior, no cap π
πΈ SYNOPSIS πΈ
say it with me: add_to_exporter(PATH, EXPORTER, OPT...) π¦
first up, the classic β exporting some data field values straight into a CSV file:
# Export the data field values to a CSV file
add_to_exporter(data,CSV, file:/tmp/test.txt, header: 1)
and if you want the whole entire record as JSON instead, she's got you:
# Export the complete record into a JSON file
add_to_exporter(data,JSON, file:/tmp/test.json, pretty:1)
and the general shape of it, fr fr β you hand over a PATH to an EXPORTER, plus one ore more OPT0s:
# In general, export a PATH to an EXPORTER with one ore more OPT0s
add_to_exporter(PATH,EXPORTER, OPT1:... , OPT2:... , OPT3:... , ...)
now here's the part that's lowkey iconic β you can use add_to_exporter to explode an ARRAY into many records π like, one thing goes in, a whole bunch of records come out. it's giving magic trick:
# Use the add_to_exporter to explode an ARRAY into many records
# E.g.
# books:
# - title: Graphic Design Rules
# year: 2003
# - title: Urban Sketching
# year: 2013
# - title: Findus flyttar ut
# year: 2012
# And a fix file: exporter.fix
do with(path => books)
add_to_exporter(.,JSON)
end
# You can get an output with 3 records using the command line function
catmandu convert JSON to Null --fix exporter.fix < book.json
so yeah β a fix file called exporter.fix, that little do with(path => books) block, and then β¨ 3 records β¨ pop out the other side using that command line function. ate and left no crumbs π
π SEE ALSO π
go be nosy, bestie, these two are the whole friend group:
Catmandu::FixπCatmandu::Exporterπ§
that's the whole page, and honestly? short and sweet, we love that for us π«Ά this was perl v5.40.1, dated 2026-01-24, and it lives in the User Contributed Perl Documentation section, manual page 3pm π byeee, go export something gorgeous π
β¨
π¦ where this page comes from
- ubuntu resolute: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR 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