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

NAME

6       CheckDigits::M10_011 - compute check digits UPS (US)
7

SYNOPSIS

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

DESCRIPTION

27   ALGORITHM
28       1.  Beginning left all numbers are weighted alternatively 1 and 2.
29
30       2.  The sum of all products is computed.
31
32       3.  The sum of step 3 ist taken modulo 10.
33
34       4.  The check digit is the difference between 10 and the number from
35           step 3.
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, www.pruefziffernberechnung.de.
72
73
74
75perl v5.34.0                      2021-07-22Algorithm::CheckDigits::M10_011(3)
Impressum