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

NAME

6       CheckDigits::MXX_006 - compute check digits with Verhoeff scheme
7

SYNOPSIS

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

DESCRIPTION

27   ALGORITHM
28       1.  Right to left all digits are permutated according to a permutation
29           table.
30
31       2.  The permutated digits are combined using a dieeder table. The first
32           with the second, the result with the third, this result with the
33           fourth and so on.
34
35       3.  The result of the last combination in the dieeder table is in such
36           a way combined that the result is 0 (zero). The number used for
37           this combination is the checksum.
38
39       For details look at the source.
40
41   METHODS
42       is_valid($number)
43           Returns true only if $number consists solely of numbers and the
44           last digit is a valid check digit according to the algorithm given
45           above.
46
47           Returns false otherwise,
48
49       complete($number)
50           The check digit for $number is computed and concatenated to the end
51           of $number.
52
53           Returns the complete number with check digit or '' if $number does
54           not consist solely of digits.
55
56       basenumber($number)
57           Returns the basenumber of $number if $number has a valid check
58           digit.
59
60           Return '' otherwise.
61
62       checkdigit($number)
63           Returns the checkdigit of $number if $number has a valid check
64           digit.
65
66           Return '' otherwise.
67
68   EXPORT
69       None by default.
70

AUTHOR

72       Mathias Weidner, "<mamawe@cpan.org>"
73

THANKS

75       Jonathan Peters wrote Algorithm::Verhoeff from which I took the routine
76       to compute the checkdigits.
77

SEE ALSO

79       perl, CheckDigits, <http://www.cs.utsa.edu/~wagner/laws/verhoeff.html>,
80       <http://www.cs.nmsu.edu/~cssem/Dickcheckdoc.pdf>
81
82
83
84perl v5.36.0                      2022-07-22Algorithm::CheckDigits::MXX_006(3)
Impressum