line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mo::utils::EAN; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
89514
|
use base qw(Exporter); |
|
3
|
|
|
|
|
18
|
|
|
3
|
|
|
|
|
356
|
|
4
|
3
|
|
|
3
|
|
20
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
71
|
|
5
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
128
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
1640
|
use Business::Barcode::EAN13 qw(valid_barcode); |
|
3
|
|
|
|
|
3276
|
|
|
3
|
|
|
|
|
188
|
|
8
|
3
|
|
|
3
|
|
1520
|
use Error::Pure qw(err); |
|
3
|
|
|
|
|
25868
|
|
|
3
|
|
|
|
|
54
|
|
9
|
3
|
|
|
3
|
|
169
|
use Readonly; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
551
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Readonly::Array our @EXPORT_OK => qw(check_ean); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = 0.01; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub check_ean { |
16
|
4
|
|
|
4
|
1
|
3658
|
my ($self, $key) = @_; |
17
|
|
|
|
|
|
|
|
18
|
4
|
100
|
|
|
|
16
|
_check_key($self, $key) && return; |
19
|
|
|
|
|
|
|
|
20
|
2
|
100
|
|
|
|
8
|
if (! valid_barcode($self->{$key})) { |
21
|
1
|
|
|
|
|
21
|
err "EAN code doesn't valid."; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
47
|
return; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _check_key { |
28
|
4
|
|
|
4
|
|
9
|
my ($self, $key) = @_; |
29
|
|
|
|
|
|
|
|
30
|
4
|
100
|
100
|
|
|
22
|
if (! exists $self->{$key} || ! defined $self->{$key}) { |
31
|
2
|
|
|
|
|
9
|
return 1; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
7
|
return 0; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |