Biblio::LCC(3pm)
πΈ NAME πΈ
Biblio::LCC β bestie, this module parses and normalizes LC-style call numbers. That's it, that's the whole job. This is the Biblio::LCC(3pm) page, straight from the User Contributed Perl Documentation, and we're gonna get you fluent in it π
β¨ SYNOPSIS β¨
use Biblio::LCC;
$normalized = Biblio::LCC->normalize('PS3573.A472242 A88 1998');
($begin, $limit) = Biblio::LCC->normalize_range('E184.5-E185');
@parts = Biblio::LCC->parse($call_number);
$call_number = Biblio::LCC->add($class, $offset);
look at that. four lines. main character energy fr fr π
π DESCRIPTION π
So here's the tea: Biblio::LCC takes Library of Congress classification ranges and call numbers, parses them, and normalizes them into a form that's suitable for a straight ASCII sort. That's the glow-up. You hand it library-flavored chaos, it hands you back something sort can actually vibe with. π¦
π PUBLIC METHODS π
π normalize($call_number)
$normalized = Biblio::LCC->normalize('PS3573.A472242 A88 1998');
Take an LC-style class (like 'PS' or 'E184.5') or a full call number (like 'PS3573.A472242 A88 1998') and turn it into a string you can compare against other normalized call numbers. The comparing part is what normalize_range down below is for, iykyk.
π normalize_range($call_number_range)
($begin, $limit) = Biblio::LCC->normalize_range('E184.5-E185');
Parses a call number range and gives you back a pair of strings, B and L, and the rule is: a call number falls inside the range if and only if its normalized form β in a straight lexicographic ASCII comparison β is greater than or equal to B and strictly less than L. That's the whole contract. Periodt.
You can specify the range in one of three ways:
π call number - call number
A pair of call numbers. The range includes the beginning call number, the ending call number, and any call numbers that have the ending call number as a prefix. Generous! π
For example, the (unnormalized) range "AS131-AS142" encompasses any class or call number from "AS131" up to but not including "AS143".
In this form, the alphabetic string that begins the second call number may be omitted, so (for example) "E184.5-185" is equivalent to "E184.5-E185". Short and slay.
Space is optional around the hyphen.
π call number
A single class or call number, in unnormalized form. This is equivalent to a pair in which each call number is the same. For example, the unnormalized range "QA141.5.A1" encompasses call numbers from "QA141.5.A1" up to but not including "QA141.5.A2".
π call number < call number
A pair of call numbers; the range includes the first call number and any call number up and not including the ending call number.
For example, the unnormalized range "DT6.7<DT7" includes everything greater than "DT6.7" and less than "DT7".
In this form, the alphabetic string that begins the second call number may be omitted, as in the form of range that uses a hyphen to separate the parts.
Space is optional around the less-than sign (<).
π parse($call_number)
($alpha, $int, $frac, $rmdr) = Biblio::LCC->parse($call_number);
Splits an LC call number into four lil pieces: alphabetic, integer, decimal fraction, and remainder (aka everything else). We'll get into those parts properly in HOW IT WORKS, hold on. π«Ά
π add($class, $offset)
$call_number = Biblio::LCC->add($class, $offset);
Adds an offset (e.g., '180.3') to a base LC class (e.g., 'GN1600') and produces another LC class (e.g., 'GN1780.3'). Math but make it library science. β¨
The base class may have only alphabetic and integer parts. An exception will be thrown if it has a fractional part (e.g., as in 'GN1600.1') or a remainder (e.g., as in 'GN1600 R5').
β οΈ okay so read that again: fractional part or remainder on the base class = exception, no cap. Don't come crying to me, the module warned you π
π HOW IT WORKS π
Call numbers are first analyzed into four parts. For example, take the call number GB1001.72.M32 E73 1988.
β alpha
GB
The one to three alphabetic characters that begin the call number.
β integer
1001
An integer from 1 to 9999 that follows.
β fraction
72
Digits that follow a decimal point after the integer part.
β remainder
M32 E73 1988
Everything that follows. The catch-all, the emotional support field, the rest of the story π«Ά
The LC Classification allows for a wide range of possible call numbers that do not fall into the simple (alpha, integer, fraction, remainder) model that this module implements. For example, the following are all valid call numbers:
E514.5 17th .S76 1986G3804.N4:3B7 K142tG3824.Y6C5 s50 .W5
It may be that in some cases further analysis, and fully correct sorting, are not possible without hardcoded knowledge of the LC classification. In many cases, however, a more sophisticated parsing model, while more complex, would result in better normalization.
π BUGS π
There are no known bugs. (Iconic. Flawless. We love that for it.) If you do find one, please report bugs on this module's RT page:
<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Biblio-LCC>
π¦ TO DO π¦
The wishlist, bestie. Not done yet, but manifesting:
- Implement a
"new"method and rewrite other methods so they may be used as class or instance methods. - Special handling of "special" call numbers (e.g., in the Gs).
- Allow caller to specify prefixes to strip (e.g.,
"Folio"). - Parse straight from the 050 or 090 field of a MARC record.
- Better error reporting.
π AUTHOR π
Paul Hoffman (nkuitse AT cpan DOT org) β the icon, the legend, the author of this whole module. π
π COPYRIGHT π
Copyright 2007-2008 Paul M. Hoffman.
This is free software, and is made available under the same terms as Perl itself. Free as in go wild, just keep the same terms. π
and that's the page, babe π perl v5.36.0, dated 2023-02-05, and yes, it's Biblio::LCC(3pm) the whole time β go sort some call numbers, you got this πΈπ¦π
π¦ where this page comes from
- debian bookworm: libbiblio-lcc-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libbiblio-lcc-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libbiblio-lcc-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libbiblio-lcc-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libbiblio-lcc-perl 0.09-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