line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::BR::CNJ; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
63665
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
812
|
use utf8; |
|
1
|
|
|
|
|
19
|
|
|
1
|
|
|
|
|
6
|
|
5
|
1
|
|
|
1
|
|
45
|
use Exporter 'import'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
233
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = 0.02; |
8
|
|
|
|
|
|
|
our @EXPORT_OK = qw/ cnj_check_number /; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub cnj_check_number { |
11
|
2
|
|
|
2
|
1
|
68
|
my $n = shift; |
12
|
2
|
|
|
|
|
13
|
my @n = $n =~ m|^(\d{7}).?(\d{2}).?(\d{4}).?(\d).?(\d{2}).?(\d{4})$|; |
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
|
|
20
|
my $d = 98-( |
15
|
|
|
|
|
|
|
( |
16
|
|
|
|
|
|
|
sprintf( '%02s', ( sprintf( '%02s', $n[0] % 97 ) . |
17
|
|
|
|
|
|
|
sprintf( '%07s', join( '', @n[2,3,4] ) ) |
18
|
|
|
|
|
|
|
) % 97 ) . |
19
|
|
|
|
|
|
|
sprintf( '%04s', $n[-1] ) . |
20
|
|
|
|
|
|
|
'00' |
21
|
|
|
|
|
|
|
) % 97 |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
2
|
100
|
|
|
|
15
|
return $d == $n[1] ? 1 : 0; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |