Catmandu/Fix/isbn10.pm

filter: Statementstmt 100% 18 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 95.8% 23 / 24 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Catmandu/Fix/Condition/is_web_uri.pm ↑ Summary Catmandu/Fix/isbn13.pm »
1 package Catmandu::Fix::isbn10;
2  
3 1 our $VERSION = '0.15';
4  
5 1 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Business::ISBN;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Catmandu::Fix::Has;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 has path => (fix_arg => 1);
11  
12 1 with 'Catmandu::Fix::SimpleGetValue';
13  
14 6 ▶sub emit_value {
Subroutine emit_value: called CC=1 SCAR=0.0
Pod undocumented
15 6 my ($self, $var) = @_;
16  
17 6 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 1;
« Catmandu/Fix/Condition/is_web_uri.pm ↑ Summary Catmandu/Fix/isbn13.pm »