1CheckDigits::M10_005(3)User Contributed Perl DocumentatioCnheckDigits::M10_005(3)
2
3
4
6 CheckDigits::M10_005 - compute check digits for Deutsche Post
7 Identcode/Leitcode (DE)
8
10 use Algorithm::CheckDigits;
11
12 $ic = CheckDigits('identcode_dp');
13
14 if ($ic->is_valid('21.802 580.906 6')) {
15 # do something
16 }
17
18 $cn = $ic->complete('21.802 580.906');
19 # $cn = '21.802 580.9066'
20
21 $cd = $ic->checkdigit('21.802 580.906 6');
22 # $cd = '6'
23
24 $bn = $ic->basenumber('21.802 580.906 6');
25 # $bn = '21.802 580.906'
26
28 ALGORITHM
29 1. Beginning left all numbers are weighted alternatively 4 and 9.
30
31 2. The sum 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.
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, <mathias@weidner.in-bad-schmiedeberg.de>
70
72 perl, CheckDigits, www.pruefziffernberechnung.de.
73
74
75
76perl v5.12.1 2009-11-20 CheckDigits::M10_005(3)