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

NAME

6       CheckDigits::M11_017 - compute check digits for EC-No, EINECS, ELINCS
7

SYNOPSIS

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

DESCRIPTION

27   ALGORITHM
28       1.  From left to right all digits are multiplied with their position in
29           the sequence.
30
31       2.  The sum of all products is computed.
32
33       3.  The sum of step 2 is taken modulo 11.
34
35           The checkdigit is the last digit of the result.
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, http://en.wikipedia.org/wiki/EC-No.
72
73
74
75perl v5.36.0                      2022-07-22Algorithm::CheckDigits::M11_017(3)
Impressum