Catman...c_paste(3pm)
π Catman...c_paste(3pm) β the manual page, but make it cute π
okay bestie, welcome to the group chat. this is the docs for Catmandu::Fix::marc_paste, and honestly? she's a little legend. buckle up π
β¨ NAME β¨
Catmandu::Fix::marc_paste β paste a MARC structured field back into the MARC record π«Ά
πΈ SYNOPSIS πΈ
# Copy and paste to the end of the record
marc_copy(001, fixed001)
set_fieldfixed001.$first.tag,002)
marc_paste(fixed001)
# Copy and paste in place (rename a field)
do marc_each(var:this)
if all_match(this.tag,001)
# Change it
set_field(this.tag,002)
# Paste it back into the record
marc_paste(this)
end
end
π¦ DESCRIPTION π¦
so basically: you take a MARC structure that was made by Catmandu::Fix::marc_struc, and you paste it back at the end of a MARC record. that's the whole vibe. it's giving copy-paste but for library data π
(and yes, the original says "stucture" β we keep it real around here, no cap. π«‘)
π METHODS π
π marc_paste(JSON_PATH, [at: MARC_PATH , [equals: REGEX]])
Paste a MARC struct PATH back in the MARC record, bestie. by default the MARC structure gets pasted at the end of the record β chill, no drama.
want it somewhere specific? optionally hand over an at option to set the MARC field after which the structure needs to be pasted. π―
and optionally you can give a regex that should match the content of that at field.
β οΈ heads up: theequalsparameter requires anatparameter. like, they're a package deal. when both are provided, then the value ofJSON_PATHwill only be pasted if the string value of theMARC_PATHinatmatches the regular expressionequals. π―
okay now the examples, because examples ate and left no crumbs:
# Paste mycopy at the end of the record
marc_paste(mycopy)
# Paste mycopy after the last 300 field
marc_paste(mycopy, at:300)
# Paste mycopy after the last 300 field with indicator1 = 1
marc_paste(mycopy, at:300[1])
# Paste mycopy after the last 300 field which has an 'a' subfield
marc_paste(mycopy, at:300a)
# Paste mycopy after the last 300 field which has an 'a' subfield equal to 'ABC'
marc_paste(mycopy, at:300a, equals:'^ABC$')
# Paste mycopy after the last 300 field with all concatinated subfields equal to 'ABC'
marc_paste(mycopy, at:300, equals:'^ABC$')
π INLINE π
not me dropping this Fix directly into a Perl script β it's giving main character energy fr fr:
use Catmandu::Fix::marc_copy as => 'marc_copy';
use Catmandu::Fix::marc_paste as => 'marc_paste';
my $data = { record => ['650', ' ', 0, 'a', 'Perl'] };
$data = marc_copy($data,'650','subject');
$data = marc_paste($data,'subject');
π SEE ALSO π
Catmandu::Fix::marc_copyπCatmandu::Fix::marc_cutβοΈ
π LICENSE AND COPYRIGHT π
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information. π«Ά
and that's the whole page, bestie β no notes, obsessed. this one shipped with perl v5.38.2 on 2024-08-03. iykyk π β¨π
π¦ where this page comes from
- debian trixie: libcatmandu-marc-perl 1.320-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatmandu-marc-perl 1.320-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-marc-perl 1.320-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