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

NAME

6       CheckDigits::M07_001 - compute check digits modulo 7 method 1
7

SYNOPSIS

9         use Algorithm::CheckDigits;
10
11         $m001 = CheckDigits('m001');
12
13         if ($m001->is_valid('1234567892')) {
14               # do something
15         }
16
17         $cn = $m001->complete('123456789');    # $cn = '1234567892'
18
19         $cd = $m001->checkdigit('1234567892'); # $cd = '2'
20
21         $bn = $m001->basenumber('1234567892'); # $bn = '123456789'
22

DESCRIPTION

24   ALGORITHM
25       1.  All digits are added.
26
27       2.  All digits at even positions are added.
28
29       3.  The sum of step 1 and 2 is taken modulo 7.
30
31       4.  This is the check digit.
32
33   METHODS
34       is_valid($number)
35           Returns true only if $number consists solely of numbers and the
36           last digit is a valid check digit according to the algorithm given
37           above.
38
39           Returns false otherwise,
40
41       complete($number)
42           The check digit for $number is computed and concatenated to the end
43           of $number.
44
45           Returns the complete number with check digit or undef if $number
46           does not consist solely of digits.
47
48       basenumber($number)
49           Returns the basenumber of $number if $number has a valid check
50           digit.
51
52           Return undef otherwise.
53
54       checkdigit($number)
55           Returns the check digit belonging to $number or undef if $number
56           does not consist solely of digits.
57
58   EXPORT
59       None by default.
60

AUTHOR

62       Mathias Weidner, "<mamawe@cpan.org>"
63

SEE ALSO

65       perl, www.pruefziffernberechnung.de.
66
67
68
69perl v5.30.1                      2020-01-29Algorithm::CheckDigits::M07_001(3)
Impressum