1Algorithm::CheckDigits:U:sMeXrX_C0o0n5t(r3i)buted Perl DAolcguomreintthamt:i:oCnheckDigits::MXX_005(3)
2
3
4

NAME

6       CheckDigits::MXX_005 - compute check digits for ESR9 (CH)
7

SYNOPSIS

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

DESCRIPTION

27   ALGORITHM
28       1.  Digits are processed left to right. For the first digit applies the
29           balance is 0.
30
31       2.  The new balance is taken from the balance table according to the
32           current balance (row) and the digit (column).
33
34       3.  The check digit is the difference from the last balance to 10 taken
35           modulo 10.
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.32.1                      2021-01-26Algorithm::CheckDigits::MXX_005(3)
Impressum