line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Business::BR::Ids;
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
22681
|
use 5;
|
|
1
|
|
|
|
|
5
|
|
5
|
1
|
|
|
1
|
|
6
|
use strict;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
6
|
1
|
|
|
1
|
|
7
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
132
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Exporter;
|
9
|
|
|
|
|
|
|
our @ISA = qw(Exporter);
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw( canon_id parse_id format_id random_id );
|
11
|
|
|
|
|
|
|
our @EXPORT = qw( test_id );
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.00_21';
|
14
|
|
|
|
|
|
|
$VERSION = eval $VERSION;
|
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
6
|
use Carp;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
194
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# a hash from entity types to packages
|
19
|
|
|
|
|
|
|
my %types = (
|
20
|
|
|
|
|
|
|
cpf => 'Business::BR::CPF',
|
21
|
|
|
|
|
|
|
cnpj => 'Business::BR::CNPJ',
|
22
|
|
|
|
|
|
|
ie => 'Business::BR::IE',
|
23
|
|
|
|
|
|
|
pis => 'Business::BR::PIS',
|
24
|
|
|
|
|
|
|
);
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# invoke($type, $subroot, @args)
|
28
|
|
|
|
|
|
|
sub _invoke {
|
29
|
6
|
|
|
6
|
|
11
|
my $type = lc shift;
|
30
|
6
|
|
|
|
|
8
|
my $subroot = shift;
|
31
|
6
|
50
|
|
|
|
16
|
my $package = $types{$type}
|
32
|
|
|
|
|
|
|
or croak "unknown '$type'\n";
|
33
|
6
|
|
|
|
|
340
|
eval "require $package";
|
34
|
6
|
50
|
|
|
|
27
|
croak $@ if $@;
|
35
|
1
|
|
|
1
|
|
6
|
no strict 'refs';
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
257
|
|
36
|
6
|
|
|
|
|
8
|
return &{"${package}::${subroot}${type}"}(@_);
|
|
6
|
|
|
|
|
31
|
|
37
|
|
|
|
|
|
|
}
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub test_id {
|
40
|
6
|
|
|
6
|
1
|
20
|
return _invoke(shift, 'test_', @_);
|
41
|
|
|
|
|
|
|
}
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub canon_id {
|
44
|
0
|
|
|
0
|
1
|
|
return _invoke(shift, 'canon_', @_);
|
45
|
|
|
|
|
|
|
}
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub format_id {
|
48
|
0
|
|
|
0
|
0
|
|
return _invoke(shift, 'format_', @_);
|
49
|
|
|
|
|
|
|
}
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub parse_id {
|
52
|
0
|
|
|
0
|
0
|
|
return _invoke(shift, 'parse_', @_);
|
53
|
|
|
|
|
|
|
}
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub random_id {
|
56
|
0
|
|
|
0
|
0
|
|
return _invoke(shift, 'random_', @_);
|
57
|
|
|
|
|
|
|
}
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1;
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__
|