1Algorithm::CheckDigits:U:sMe4r3_C0o0n1t(r3i)buted Perl DAolcguomreintthamt:i:oCnheckDigits::M43_001(3)
2
3
4
6 CheckDigits::M43_001 - compute check digits for Code-39
7
9 use Algorithm::CheckDigits;
10
11 $c39 = CheckDigits('code_39');
12
13 if ($c39->is_valid('AB-123K')) {
14 # do something
15 }
16
17 $cn = $c39->complete('AB-123');
18 # $cn = 'AB-123K'
19
20 $cd = $c39->checkdigit('AB-123K');
21 # $cd = 'K'
22
23 $bn = $c39->basenumber('AB-123K');
24 # $bn = 'AB-123'
25
27 ALGORITHM
28 1. After replacing all non numeric letters with their respective
29 values, the sum of all numbers is computers
30
31 2. The checkdigit is the sum from step 1 taken modulo 43.
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 '' if $number does
46 not consist solely of digits and spaces.
47
48 basenumber($number)
49 Returns the basenumber of $number if $number has a valid check
50 digit.
51
52 Return '' otherwise.
53
54 checkdigit($number)
55 Returns the checkdigit of $number if $number has a valid check
56 digit.
57
58 Return '' otherwise.
59
60 EXPORT
61 None by default.
62
64 Mathias Weidner, "<mamawe@cpan.org>"
65
67 perl, CheckDigits, www.pruefziffernberechnung.de.
68
69
70
71perl v5.28.0 2018-07-14Algorithm::CheckDigits::M43_001(3)