1Algorithm::CheckDigits:U:sMe1r0_C0o0n2t(r3i)buted Perl DAolcguomreintthamt:i:oCnheckDigits::M10_002(3)
2
3
4
6 CheckDigits::M10_002 - compute check digits for CINS (US), SIREN (FR),
7 SIRET (FR)
8
10 use Algorithm::CheckDigits;
11
12 $siret = CheckDigits('siret');
13
14 if ($siret->is_valid('73282932000074')) {
15 # do something
16 }
17
18 $cn = $siret->complete('7328293200007');
19 # $cn = '73282932000074'
20
21 $cd = $siret->checkdigit('73282932000074');
22 # $cd = '4'
23
24 $bn = $siret->basenumber('73282932000074');
25 # $bn = '7328293200007'
26
28 ALGORITHM
29 1. Beginning right all numbers are weighted alternatively 1 and 2.
30
31 2. The total of the digits of all products is computed.
32
33 3. The sum of step 3 ist taken modulo 10.
34
35 4. The check digit is the difference between 10 and the number from
36 step 3 taken modulo 10.
37
38 METHODS
39 is_valid($number)
40 Returns true only if $number consists solely of numbers and the
41 last digit is a valid check digit according to the algorithm given
42 above.
43
44 Returns false otherwise,
45
46 complete($number)
47 The check digit for $number is computed and concatenated to the end
48 of $number.
49
50 Returns the complete number with check digit or '' if $number does
51 not consist solely of digits and spaces.
52
53 basenumber($number)
54 Returns the basenumber of $number if $number has a valid check
55 digit.
56
57 Return '' otherwise.
58
59 checkdigit($number)
60 Returns the checkdigit of $number if $number has a valid check
61 digit.
62
63 Return '' otherwise.
64
65 EXPORT
66 None by default.
67
69 Mathias Weidner, "<mamawe@cpan.org>"
70
72 perl, CheckDigits, www.pruefziffernberechnung.de.
73 www.dsi.cnrs.fr/bureau_qualite/admindonnees/documents/siren.pdf
74
75
76
77perl v5.32.0 2020-07-28Algorithm::CheckDigits::M10_002(3)