line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
our $VERSION = '0.15'; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use Catmandu::Sane; |
5
|
1
|
|
|
1
|
|
85990
|
use Business::ISBN; |
|
1
|
|
|
|
|
152203
|
|
|
1
|
|
|
|
|
7
|
|
6
|
1
|
|
|
1
|
|
642
|
use Moo; |
|
1
|
|
|
|
|
36206
|
|
|
1
|
|
|
|
|
36
|
|
7
|
1
|
|
|
1
|
|
6
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
8
|
1
|
|
|
1
|
|
667
|
|
|
1
|
|
|
|
|
781
|
|
|
1
|
|
|
|
|
7
|
|
9
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
with 'Catmandu::Fix::SimpleGetValue'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my ($self, $var) = @_; |
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
0
|
10326
|
qq| |
16
|
|
|
|
|
|
|
if (is_value(${var}) && length(${var})) { |
17
|
2
|
|
|
|
|
13
|
my \$val = ${var}; |
18
|
|
|
|
|
|
|
\$val =~ s/\\s.*//; |
19
|
|
|
|
|
|
|
my \$isbn = Business::ISBN->new(\$val); |
20
|
|
|
|
|
|
|
if (defined \$isbn && \$isbn->is_valid) { |
21
|
|
|
|
|
|
|
my \$isbn13 = \$isbn->as_isbn13->as_string; |
22
|
|
|
|
|
|
|
my \$isbn13d = \$isbn13; |
23
|
|
|
|
|
|
|
\$isbn13d =~ s/\-//g; |
24
|
|
|
|
|
|
|
my \$isbn10 = \$isbn->as_isbn10; |
25
|
|
|
|
|
|
|
if (\$isbn10) { |
26
|
|
|
|
|
|
|
my \$isbn10d = \$isbn10->as_string; |
27
|
|
|
|
|
|
|
\$isbn10d =~ s/\-//g; |
28
|
|
|
|
|
|
|
${var} = [\$isbn10->as_string, \$isbn10d, \$isbn13, \$isbn13d]; |
29
|
|
|
|
|
|
|
} else { |
30
|
|
|
|
|
|
|
${var} = [(\$isbn13, \$isbn13d)]; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Catmandu::Fix::isbn_versions - provide different forms for an ISBN |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 SYNOPSIS |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Convert any given ISBN to ISBN-13 and ISBN-10 (if possible) with and without dashes. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SEE ALSO |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
L<Catmandu::Fix>, L<Catmandu::Fix::isbn10>, L<Catmandu::Fix::isbn13> |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |