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

NAME

6       CheckDigits::M10_003 - compute check digits for ISMN
7

SYNOPSIS

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

DESCRIPTION

27   ALGORITHM
28       1.  The 'M' as the first number gets the value 3.  Beginning left all
29           numbers are weighted alternatively 3 and 1.
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 taken modulo 10.
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

AUTHOR

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

SEE ALSO

72       perl, CheckDigits, www.pruefziffernberechnung.de.
73
74
75
76perl v5.32.1                      2021-01-26Algorithm::CheckDigits::M10_003(3)
Impressum