Library::CallNumber::LC - Deal with Library-of-Congress call numbers
Version 0.10;
Utility functions to deal with Library of Congress Call Numbers
use Library::CallNumber::LC; my $a = Library::CallNumber::LC->new('A 123.4 .c11'); print $a->normalize; # normalizes for string comparisons. # gives 'A 012340C110' print $a->start_of_range; # same as "normalize" my $b = Library::CallNumber::LC->new('B11 .c13 .d11'); print $b->normalize; # gives 'B 001100C130D110' my @range = ($a->start_of_range, $b->end_of_range); # end of range is 'B 001100C130D119~999' # Get components suitable for printing (e.g., number and decimal joined, leading dot on first cutter) @comps = Library::CallNumber::LC->new('A 123.4 .c11')->components() # Same thing, but return empty strings for missing components (e.g., the cutters) @comps = Library::CallNumber::LC->new('A 123.4 .c11')->components('true');
Library::CallNumber::LC is mostly designed to do call number normalization, with the following goals:
The normalized call numbers are comparable with each other, for proper sorting
The normalized call number is a short as possible, so left-anchored wildcard searches are possible (e.g., searching on "A11*" should give you all the A11 call numbers)
A range defined by start_of_range and end_of_range should be correct, assuming that the string given for the end of the range is, in fact, a left prefix.
That last point needs some explanation. The idea is that if someone gives a range of, say, A-AZ, what they really mean is A - AZ9999.99. The end_of_range method pads the given call number out to three cutters if need be. There is no attempt to make end_of_range normalization correspond to anything in real life.
Regexp constants to deal with matching LC and variants
@comps = Library::CallNumber::LC->new('A 123.4 .c11')->components($returnAll)
Returns an array of the individual components of the call number (or undef if it doesn't look like a call number). Components are:
alpha
number (numeric.decimal)
cutter1
cutter2
cutter3
"extra" (anything after the cutters)
The optional argument <I returnAll> (false by default) determines whether or not empty components (e.g., extra cutters) get a slot in the returned list.
Base function to perform normalization. $bottomout, if true, forces a "range end". $fulllength determines if the return value should be padded all the way out.
Force normalization to return the full-length string (as opposed to the shortest possible string) for ease in converting to an int.
Turn everything up to and including the second cutter into a long integer. Useful for fast range checks, although obviously not perfectly accurate.
Bill Dueber, <dueberb at umich.edu>
<dueberb at umich.edu>
Please report any bugs or feature requests through the web interface at http://code.google.com/p/library-callnumber-lc/issues/list. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc Library::CallNumber::LC
You can also look for information at the Google Code page:
http://code.google.com/p/library-callnumber-lc/
Copyright 2009 Bill Dueber, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as the new BSD licsense as described at http://www.opensource.org/licenses/bsd-license.php
To install Library::CallNumber::LC, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Library::CallNumber::LC
CPAN shell
perl -MCPAN -e shell install Library::CallNumber::LC
For more information on module installation, please visit the detailed CPAN module installation guide.