line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::isbn10; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.14'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
103899
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
190285
|
|
|
1
|
|
|
|
|
7
|
|
6
|
1
|
|
|
1
|
|
880
|
use Business::ISBN; |
|
1
|
|
|
|
|
42788
|
|
|
1
|
|
|
|
|
51
|
|
7
|
1
|
|
|
1
|
|
11
|
use Moo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
10
|
|
8
|
1
|
|
|
1
|
|
917
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
995
|
|
|
1
|
|
|
|
|
6
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'Catmandu::Fix::SimpleGetValue'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub emit_value { |
15
|
6
|
|
|
6
|
0
|
19510
|
my ($self, $var) = @_; |
16
|
|
|
|
|
|
|
|
17
|
6
|
|
|
|
|
30
|
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; |