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