1 package C4::ClassSplitRoutine::LCC;
3 # Copyright 2018 Koha Development Team
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
21 use Library::CallNumber::LC;
27 C4::ClassSplitRoutine::LCC - LCC call number split method
31 use C4::ClassSplitRoutine;
33 my $cn_split = C4::ClassSplitRoutine::LCC::split_callnumber($cn_item);
37 =head2 split_callnumber
39 my $cn_split = C4::ClassSplitRoutine::LCC::split_callnumber($cn_item);
43 sub split_callnumber {
45 # lccn examples: 'HE8700.7 .P6T44 1983', 'BS2545.E8 H39 1996';
46 my @lines = Library::CallNumber::LC->new($cn_item)->components();
47 unless (scalar @lines && defined $lines[0]) {
48 Koha::Logger->get->debug(sprintf('regexp failed to match string: %s', $cn_item));
49 @lines = $cn_item; # if no match, just use the whole string.
51 my $LastPiece = pop @lines;
52 push @lines, split /\s+/, $LastPiece if $LastPiece; # split the last piece into an arbitrary number of pieces at spaces
60 Koha Development Team <http://koha-community.org/>