line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::BR::CNJ::Format; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
53611
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
475
|
use utf8; |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
4
|
|
5
|
1
|
|
|
1
|
|
26
|
use Exporter 'import'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
140
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = 0.01; |
8
|
|
|
|
|
|
|
our @EXPORT_OK = qw/ cnj_format /; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub cnj_split { |
11
|
1
|
|
|
1
|
0
|
3
|
my $t = $_[0]; |
12
|
1
|
|
|
|
|
2
|
$t =~ s/[^0-9]//g; |
13
|
1
|
|
|
|
|
8
|
my @r = $t =~ /(.+)(..)(....)(.)(..)(....)$/; |
14
|
1
|
|
|
|
|
11
|
return @r; |
15
|
|
|
|
|
|
|
# return ( $1, $2, $3, $4, $5, $6 ); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
# Format number to CNJ format NNNNNNN-DD.AAAA.J.TR.OOOO |
20
|
|
|
|
|
|
|
# |
21
|
|
|
|
|
|
|
sub cnj_format { |
22
|
1
|
|
|
1
|
1
|
63
|
return sprintf( '%07d-%02d.%04d.%d.%02d.%04d', cnj_split( shift ) ); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
__END__ |