line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::FR::SIRET;
|
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
42022
|
use strict;
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
76
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
54
|
|
5
|
2
|
|
|
2
|
|
10214
|
use Algorithm::LUHN;
|
|
2
|
|
|
|
|
774
|
|
|
2
|
|
|
|
|
1018
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.01';
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub _check_siret {
|
10
|
18
|
|
|
18
|
|
27
|
my ($class, $siret) = @_;
|
11
|
|
|
|
|
|
|
|
12
|
18
|
|
|
|
|
62
|
$siret =~ s#\s+##g;
|
13
|
|
|
|
|
|
|
|
14
|
18
|
100
|
|
|
|
69
|
my $nb_max = ref($class) =~ /T$/ ? 14 : 9;
|
15
|
|
|
|
|
|
|
|
16
|
18
|
100
|
|
|
|
142
|
return '' if ($siret !~ /^\d{$nb_max}$/);
|
17
|
|
|
|
|
|
|
|
18
|
8
|
|
|
|
|
23
|
return $siret;
|
19
|
|
|
|
|
|
|
}
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new {
|
22
|
12
|
|
|
12
|
1
|
4055
|
my ($class, $siret) = @_;
|
23
|
|
|
|
|
|
|
|
24
|
12
|
|
|
|
|
43
|
my $self = bless \$siret, $class;
|
25
|
|
|
|
|
|
|
|
26
|
12
|
|
100
|
|
|
57
|
$siret ||= '';
|
27
|
12
|
|
|
|
|
33
|
$siret = $self->_check_siret($siret);
|
28
|
|
|
|
|
|
|
|
29
|
12
|
|
|
|
|
62
|
$self;
|
30
|
|
|
|
|
|
|
}
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub siren {
|
33
|
8
|
|
|
8
|
0
|
518
|
my $self = shift;
|
34
|
8
|
|
|
|
|
9
|
my $siret = shift;
|
35
|
|
|
|
|
|
|
|
36
|
8
|
|
|
|
|
25
|
return $self->siret($siret);
|
37
|
|
|
|
|
|
|
}
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub siret {
|
40
|
24
|
|
|
24
|
1
|
397
|
my $self = shift;
|
41
|
24
|
|
|
|
|
27
|
my $siret = shift;
|
42
|
|
|
|
|
|
|
|
43
|
24
|
100
|
|
|
|
61
|
$$self = $self->_check_siret($siret) if ($siret);
|
44
|
|
|
|
|
|
|
|
45
|
24
|
|
|
|
|
119
|
return $$self;
|
46
|
|
|
|
|
|
|
}
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub is_valid {
|
49
|
8
|
|
|
8
|
1
|
14
|
my $self = shift;
|
50
|
8
|
|
|
|
|
14
|
my $siret = shift;
|
51
|
|
|
|
|
|
|
|
52
|
8
|
100
|
|
|
|
25
|
$$self = $self->_check_siret($siret) if ($siret);
|
53
|
|
|
|
|
|
|
|
54
|
8
|
|
|
|
|
21
|
return Algorithm::LUHN::is_valid($self->siret);
|
55
|
|
|
|
|
|
|
}
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1;
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__
|