MARC::Spec(3pm)
π MARC::Spec β the manual page, but make it a group chat π
okay bestie so this is MARC::Spec, a Perl module from the User Contributed Perl Documentation section (that's the 3pm part, iykyk). It's a MARCspec parser and builder, and honestly? it's giving structural engineering but for library records. π¦
β¨ NAME β¨
MARC::Spec β A MARCspec parser and builder. that's it, that's the whole vibe. π
β¨ SYNOPSIS β¨
no cap, here's the whole thing, exactly as it goes:
use MARC::Spec;
# Parsing MARCspec from a string
my $ms = MARC::Spec::parse('246[0-1]$f{245$h~\[microform\]|245$h~\microfilm}');
# Structure
say ref $ms; # MARC::Spec
say ref $ms->field; # MARC::Spec::Field
say ref $ms->subfields; # ARRAY
say ref $ms->subfields->[0]; # MARC::Spec::Subfield
say ref $ms->subfields->[0]->subspecs; # ARRAY
say ref $ms->subfields->[0]->subspecs->[0]; # ARRAY
say ref $ms->subfields->[0]->subspecs->[0]->[1]; # MARC::Spec::Subspec
say ref $ms->subfields->[0]->subspecs->[0]->[1]->left; # MARC::Spec
say ref $ms->subfields->[0]->subspecs->[0]->[1]->right; # MARC::Spec::Comparisonstring
# Access to attributes
say $ms->field->base; # 246[0-1]
say $ms->field->tag; # 246
say $ms->field->index_start; # 0
say $ms->field->index_end; # 1
say $ms->field->index_length; # 2
say $ms->subfields->[0]->base; # 'f[0-#]'
say $ms->subfields->[0]->code; # 'f'
say $ms->subfields->[0]->index_start; # 0
say $ms->subfields->[0]->index_end; # '#'
say $ms->subfields->[0]->subspecs->[0]->[0]->subterms; # '245$h~\[microform\]'
say $ms->subfields->[0]->subspecs->[0]->[0]->left->field->tag; # 245
say $ms->subfields->[0]->subspecs->[0]->[0]->left->field->index_length; # -1
say $ms->subfields->[0]->subspecs->[0]->[0]->left->subfields->[0]->code; # 'h'
say $ms->subfields->[0]->subspecs->[0]->[0]->right->comparable; # '[microform]'
say $ms->subfields->[0]->subspecs->[0]->[1]->right->comparable; # 'microfilm'
# creating MARCspec from scratch
my $field = MARC::Spec::Field->new('245');
my $subfield = MARC::Spec::Subfield->new('a');
my $spec = MARC::Spec->new($field);
$spec->add_subfield($subfield);
likeβ¦ look at that nesting. she's nested. she contains multitudes. π
β¨ DESCRIPTION β¨
MARC::Spec is a MARCspec parser and builder. MARCspec is A common MARC record path language (http://marcspec.github.io/MARCspec/). periodt. π
β¨ FUNCTIONS β¨
parse(Str)
Parses a MARCspec as string and returns an instance of MARC::Spec. you hand it a string, it hands you a whole object. iconic behaviour. β¨
β¨ METHODS β¨
new(MARC::Spec::Field)
Create a new MARC::Spec instance. the parameter must be an instance of MARC::Spec::Field. no substitutions, bestie. π«Ά
add_subfield(MARC::Spec::Subfield)
Appends a subfield to the array of the attribute subfields. the parameter must be an instance of MARC::Spec::Subfield. π
add_subfields(ArrayRef[MARC::Spec::Subfield])
Appends subfields to the array of the attribute subfields. the parameter must be an ArrayRef, and the elements must be instances of MARC::Spec::Subfield. it's giving bulk add, it's giving efficiency. π₯
β¨ PREDICATES β¨
has_subfields
Returns true if attribute subfields has an value and false otherwise. π
has_indicator
Returns true if attribute indicator has an value and false otherwise. π
β¨ ATTRIBUTES β¨
fieldβ Obligatory. the attributefieldis an instance of MARC::Spec::Field. you literally cannot skip this one. πsubfieldsβ If defined,subfieldsis an array of instances of MARC::Spec::Subfield. β¨indicatorβ If defined,indicatoris an instance of MARC::Spec::Indicator. β¨
β¨ AUTHOR β¨
Carsten Klee <klee at cpan.org> β the main character who wrote all this. ππ
β¨ CONTRIBUTORS β¨
- Johann Rolschewski,
<jorol at cpan>β the bestie who pulled up and helped. π«Ά
β¨ COPYRIGHT AND LICENSE β¨
This software is copyright (c) 2016 by Carsten Klee.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
so yeah β free, open, slay. π β¨
β¨ BUGS β¨
Please report any bugs to https://github.com/MARCspec/MARC-Spec/issues
not me asking you to file an issue π β but fr fr, if something's broken, that's the link. don't just suffer in silence, bestie. π
β¨ SEE ALSO β¨
the whole friend group, all linked up:
- MARC::Spec::Field
- MARC::Spec::Subfield
- MARC::Spec::Indicator
- MARC::Spec::Subspec
- MARC::Spec::Structure
- MARC::Spec::Comparisonstring
- MARC::Spec::Parser
and that's the page, bestie π this one shipped with perl v5.34.0, dated 2022-06-15, and yes the manual name really is MARC::Spec(3pm) the whole time. go parse something gorgeous. ππ¦β¨
π¦ where this page comes from
- debian bookworm: libmarc-spec-perl 2.0.3-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmarc-spec-perl 2.0.3-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmarc-spec-perl 2.0.3-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmarc-spec-perl 2.0.3-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmarc-spec-perl 2.0.3-2 Β· 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