1Algorithm::CheckDigits:U:sMeXrX_C0o0n4t(r3i)buted Perl DAolcguomreintthamt:i:oCnheckDigits::MXX_004(3)
2
3
4
6 CheckDigits::MXX_004 - compute check digits for VAT RN (AT)
7
9 use Algorithm::CheckDigits;
10
11 $vat = CheckDigits('ustid_at');
12
13 if ($vat->is_valid('U13585627')) {
14 # do something
15 }
16
17 $cn = $vat->complete('U1358562');
18 # $cn = 'U13585627'
19
20 $cd = $vat->checkdigit('U13585627');
21 # $cd = '7'
22
23 $bn = $vat->basenumber('U13585627');
24 # $bn = 'U1358562'
25
27 ALGORITHM
28 1. Beginning right all numbers before the check digit are weighted
29 alternatively 1 and 2.
30
31 2. The total of the digits of all products is computed and then
32 subtracted from 96.
33
34 3. The check digit is the sum of step 3 taken modulo 10.
35
36 METHODS
37 is_valid($number)
38 Returns true only if $number consists solely of numbers and the
39 last digit is a valid check digit according to the algorithm given
40 above.
41
42 Returns false otherwise,
43
44 complete($number)
45 The check digit for $number is computed and concatenated to the end
46 of $number.
47
48 Returns the complete number with check digit or '' if $number does
49 not consist solely of digits and spaces.
50
51 basenumber($number)
52 Returns the basenumber of $number if $number has a valid check
53 digit.
54
55 Return '' otherwise.
56
57 checkdigit($number)
58 Returns the checkdigit of $number if $number has a valid check
59 digit.
60
61 Return '' otherwise.
62
63 EXPORT
64 None by default.
65
67 Mathias Weidner, "<mamawe@cpan.org>"
68
70 perl, CheckDigits, www.pruefziffernberechnung.de.
71
72
73
74perl v5.30.0 2019-07-26Algorithm::CheckDigits::MXX_004(3)