1Algorithm::CheckDigits:U:sMe1r1_C0o0n2t(r3ipbmu)ted PerlAlDgoocruimtehnmt:a:tCihoenckDigits::M11_002(3pm)
2
3
4

NAME

6       CheckDigits::M11_002 - compute check digits for PZN (DE)
7

SYNOPSIS

9         use Algorithm::CheckDigits;
10
11         $pzn = CheckDigits('pzn');
12
13         if ($pzn->is_valid('4877800')) {
14               # do something
15         }
16
17         $cn = $pzn->complete('487780');
18         # $cn = '4877800'
19
20         $cd = $pzn->checkdigit('4877800');
21         # $cd = '0'
22
23         $bn = $pzn->basenumber('4877800');
24         # $bn = '487780'
25

DESCRIPTION

27   ALGORITHM
28       1.  From left to right beginning with the first position all digits are
29           multiplied with 2,3,4,...
30
31       2.  The sum of all products is computed.
32
33       3.  The checkdigit ist the sum of step 2 taken modulo 11.
34
35       4.  If the checkdigit is '10' the whole number is not taken as a PZN.
36
37   METHODS
38       is_valid($number)
39           Returns true only if $number consists solely of numbers and the
40           last digit is a valid check digit according to the algorithm given
41           above.
42
43           Returns false otherwise,
44
45       complete($number)
46           The check digit for $number is computed and concatenated to the end
47           of $number.
48
49           Returns the complete number with check digit or '' if $number does
50           not consist solely of digits and spaces.
51
52       basenumber($number)
53           Returns the basenumber of $number if $number has a valid check
54           digit.
55
56           Return '' otherwise.
57
58       checkdigit($number)
59           Returns the checkdigit of $number if $number has a valid check
60           digit.
61
62           Return '' otherwise.
63
64   EXPORT
65       None by default.
66

AUTHOR

68       Mathias Weidner, "<mamawe@cpan.org>"
69

SEE ALSO

71       perl, CheckDigits, www.pruefziffernberechnung.de.
72
73
74
75perl v5.38.0                      2023-07-2A0lgorithm::CheckDigits::M11_002(3pm)
Impressum