Lines 115-121
sub _get_text_fields {
Link Here
|
115 |
my $csv = Text::CSV_XS->new({allow_whitespace => 1}); |
115 |
my $csv = Text::CSV_XS->new({allow_whitespace => 1}); |
116 |
my $status = $csv->parse($format_string); |
116 |
my $status = $csv->parse($format_string); |
117 |
my @sorted_fields = map {{ 'code' => $_, desc => $_ }} |
117 |
my @sorted_fields = map {{ 'code' => $_, desc => $_ }} |
118 |
map { $_ eq 'callnumber' ? 'itemcallnumber' : $_ } # see bug 5653 |
118 |
map { $_ && $_ eq 'callnumber' ? |
|
|
119 |
'itemcallnumber' : $_ } # see bug 5653 |
119 |
$csv->fields(); |
120 |
$csv->fields(); |
120 |
my $error = $csv->error_input(); |
121 |
my $error = $csv->error_input(); |
121 |
warn sprintf('Text field sort failed with this error: %s', $error) if $error; |
122 |
warn sprintf('Text field sort failed with this error: %s', $error) if $error; |
Lines 129-138
sub _split_lccn {
Link Here
|
129 |
# lccn examples: 'HE8700.7 .P6T44 1983', 'BS2545.E8 H39 1996'; |
130 |
# lccn examples: 'HE8700.7 .P6T44 1983', 'BS2545.E8 H39 1996'; |
130 |
my @parts = Library::CallNumber::LC->new($lccn)->components(); |
131 |
my @parts = Library::CallNumber::LC->new($lccn)->components(); |
131 |
unless (scalar @parts && defined $parts[0]) { |
132 |
unless (scalar @parts && defined $parts[0]) { |
132 |
warn sprintf('regexp failed to match string: %s', $_); |
133 |
$debug and warn sprintf('regexp failed to match string: %s', $_); |
133 |
@parts = $_; # if no match, just use the whole string. |
134 |
@parts = $_; # if no match, just use the whole string. |
134 |
} |
135 |
} |
135 |
push @parts, split /\s+/, pop @parts; # split the last piece into an arbitrary number of pieces at spaces |
136 |
my $LastPiece = pop @parts; |
|
|
137 |
push @parts, split /\s+/, $LastPiece if $LastPiece; # split the last piece into an arbitrary number of pieces at spaces |
136 |
$debug and warn "split_lccn array: ", join(" | ", @parts), "\n"; |
138 |
$debug and warn "split_lccn array: ", join(" | ", @parts), "\n"; |
137 |
return @parts; |
139 |
return @parts; |
138 |
} |
140 |
} |
139 |
- |
|
|