Catman...arc_add(3pm)

πŸ“¦
version 1.320 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

okay so bestie, meet Catmandu::Fix::marc_add β€” she adds new fields to marc. that's it, that's the whole job, and she does it flawlessly πŸŽ€


✨ SYNOPSIS ✨

like, here's the vibe in code form, no notes:

# Set literal values
marc_add('900', a, 'test' , 'b', test)
marc_add('900', ind1 , ' ' , a, 'test' , 'b', test)
marc_add('900', ind1 , ' ' , a, 'test' , 'b', test)

# Set control fields
marc_add('009','_','23123131')

# Copy data from an other field (when the field value is an array, the
# subfield will be repeated)
marc_add('900', a, '$.my.data.field')

🌸 DESCRIPTION 🌸

she adds a new subfield to a MARC record. simple as that, lowkey iconic, periodt πŸ’…


πŸ‘‘ METHODS πŸ‘‘

πŸ¦‹ marc_add(MARC_FIELD, SUBFIELD, VALUE, [ SUBFIELD, VALUE , ... ])

adds new subfields to a MARC record, bestie. the MARC_FIELD is literally just the marc field name, and every other argument you hand over is one of the subfields you want added. she's a good listener like that 🫢

by default she's gonna drop in literal values. but if you want her to point at a value that already exists somewhere in the record, use the JSON_PATH syntax with a dollar '$.' tacked on the front. that's the whole trick, iykyk ✨


🌈 INLINE 🌈

not me telling you this Fix can be used inline in a Perl script β€” because she CAN:

use Catmandu::Fix::marc_add as => 'marc_add';

my $data = { record => [...] };

$data = marc_add($data,'245','a','title');

main character energy fr fr πŸ’œ


⭐ SEE ALSO ⭐

go give these queens some love too:

  • Catmandu::Fix::marc_set
  • Catmandu::Fix::marc_copy
  • Catmandu::Fix::marc_cut
  • Catmandu::Fix::marc_paste

this page came to you courtesy of the User Contributed Perl Documentation girlies, running perl v5.38.2 and dated 2024-08-03 β€” mwah, slay, bye bestie πŸŽ€πŸ’–
πŸ“¦ where this page comes from