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

NAME

6       CheckDigits::M10_004 - compute check digits for 2aus5, EAN, ILN,
7       ISBN13, NVE
8

SYNOPSIS

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

DESCRIPTION

28   ALGORITHM
29       1.  Beginning right all numbers are weighted alternatively 1 and 3
30           (that is the check digit is weighted 1).
31
32       2.  The sum of all products is computed.
33
34       3.  The sum of step 3 ist taken modulo 10.
35
36       4.  The check digit is the difference between 10 and the number from
37           step 3.
38
39       To validate the total of the digits of all numbers inclusive check
40       digit taken modulo 10 must be 0.
41
42   METHODS
43       is_valid($number)
44           Returns true only if $number consists solely of digits, spaces and
45           hyphen and the last digit is a valid check digit according to the
46           algorithm given above.
47
48           Returns false otherwise,
49
50       complete($number)
51           The check digit for $number is computed and concatenated to the end
52           of $number.
53
54           Returns the complete number with check digit or '' if $number does
55           not consist solely of digits, spaces and hyphen.
56
57       basenumber($number)
58           Returns the basenumber of $number if $number has a valid check
59           digit.
60
61           Return '' otherwise.
62
63       checkdigit($number)
64           Returns the checkdigit of $number if $number has a valid check
65           digit.
66
67           Return '' otherwise.
68
69   EXPORT
70       None by default.
71

BUGS AND LIMITATIONS

73       When invoked as "CheckDigits('isbn13')" the module checks whether the
74       first three digits (the country code) are 978 or 979, the current (as
75       of 2006) EAN country codes for books. If at any time other EAN country
76       codes for ISBN-13 will be specified and the then responsible maintainer
77       ignores this in the code, please send a friendly email.
78

AUTHOR

80       Mathias Weidner, "<mamawe@cpan.org>"
81

SEE ALSO

83       perl, CheckDigits, www.pruefziffernberechnung.de.
84
85
86
87perl v5.34.0                      2022-01-20Algorithm::CheckDigits::M10_004(3)
Impressum