line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::isbn10; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.13'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
85304
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
158519
|
|
|
1
|
|
|
|
|
7
|
|
6
|
1
|
|
|
1
|
|
763
|
use Business::ISBN; |
|
1
|
|
|
|
|
30408
|
|
|
1
|
|
|
|
|
37
|
|
7
|
1
|
|
|
1
|
|
7
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
8
|
1
|
|
|
1
|
|
691
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
861
|
|
|
1
|
|
|
|
|
5
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'Catmandu::Fix::SimpleGetValue'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub emit_value { |
15
|
6
|
|
|
6
|
0
|
16528
|
my ($self, $var) = @_; |
16
|
|
|
|
|
|
|
|
17
|
6
|
|
|
|
|
25
|
qq| |
18
|
|
|
|
|
|
|
if (is_value(${var}) && length(${var})) { |
19
|
|
|
|
|
|
|
my \$isbn10 = Business::ISBN->new(${var})->as_isbn10; |
20
|
|
|
|
|
|
|
${var} = \$isbn10 ? \$isbn10->as_string : ''; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Catmandu::Fix::isbn10 - normalize the isbn value of a key in 10-digit form |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 SYNOPSIS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Normalize the ISBN value of isbn_field. |
32
|
|
|
|
|
|
|
# e.g. isbn_field => '1565922573' |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
isbn10(isbn_field) # isbn_field => '1-56592-257-3' |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 SEE ALSO |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
L<Catmandu::Fix>, L<Catmandu::Fix::isbn13> |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |