Catman...apping(3pm)
π NAME π
Catmandu::Fix::mapping β ok so bestie, this one moves several fields by a lookup table. that's the whole vibe. several fields, one lookup table, slay π
β¨ SYNOPSIS β¨
okay so here's literally the entire thing, no cap, read it slowly because it eats:
# field_mapping.csv
# AU,author
# TI,title
# PU,publisher
# Y,year
# fields found in the field_mapping.csv will be replaced
# {AU => "Einstein"}
mapping(field_mapping.csv)
# {author => "Einstein"}
# fields found in the field_mapping.csv with keep option will be copied
# {AU => "Einstein"}
mapping(field_mapping.csv, keep: 1)
# {AU => => "Einstein", author => "Einstein"}
# values not found will be kept
# {foo => {bar => 232}}
mapping(field_mapping.csv)
# {foo => {bar => 232}}
# in case you have a different seperator
mapping(field_mapping.csv, sep_char: |)
let's break it down so it actually makes sense π§
- the lookup table lives in a file like
field_mapping.csv, and each line is a<from>,<to>pair β soAU,authormeans "hey,AU? yeah that'sauthornow." - fields that show up in the lookup table get replaced. you come in as
{AU => "Einstein"}, you leave as{author => "Einstein"}. glow up β¨ - add the
keepoption and instead of replacing, the field gets copied β so{AU => "Einstein"}becomes{AU => => "Einstein", author => "Einstein"}. both of them. icon behavior π - values that aren't in the lookup table? kept, untouched, exactly as they were.
{foo => {bar => 232}}in,{foo => {bar => 232}}out. we do not touch what we were not asked to touch π«Ά - got a different seperator in your file? pass
sep_charand set it, likemapping(field_mapping.csv, sep_char: |). iykyk π₯
ngl bestie, the doc calls it a "seperator" β that's how it's written, that's how i'm saying it, we don't correct the source material π
π SEE ALSO π
go read these next, fr fr:
Catmandu::FixCatmandu::Fix::lookup
and that's the whole page, bestie!! this one shipped in perl v5.40.1, dated 2026-01-24, from the User Contributed Perl Documentation collection πβ¨ mwah, go move some fields, you're gonna ate ππ¦
π¦ 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