1Algorithm::CheckDigits:U:sMe2r3_C0o0n2t(r3i)buted Perl DAolcguomreintthamt:i:oCnheckDigits::M23_002(3)
2
3
4
6 CheckDigits::M23_002 - compute check digits for VAT Registration Number
7 (IE)
8
10 use Algorithm::CheckDigits;
11
12 $dni = CheckDigits('ustid_ie');
13
14 if ($dni->is_valid('8473625E')) {
15 # do something
16 }
17
18 $cn = $dni->complete('8473625');
19 # $cn = '8473625E'
20
21 $cd = $dni->checkdigit('8473625E');
22 # $cd = 'E'
23
24 $bn = $dni->basenumber('8473625E');
25 # $bn = '8473625'
26
28 ALGORITHM
29 1. Beginning right all digits are weighted with their position in the
30 number (i.e. the number left from the check digit is multiplied
31 with 2, the next with 3 and so on).
32
33 2. All products are added.
34
35 3. The check digit is the sum from step 2 modulo 23. This number is
36 expressed as the corresponding letter from the alphabet where A-V
37 correspond to 1-22 and W stands for check digit 0.
38
39 METHODS
40 is_valid($number)
41 Returns true only if $number consists solely of numbers and the
42 last digit is a valid check digit according to the algorithm given
43 above.
44
45 Returns false otherwise,
46
47 complete($number)
48 The check digit for $number is computed and concatenated to the end
49 of $number.
50
51 Returns the complete number with check digit or '' if $number does
52 not consist solely of digits and spaces.
53
54 basenumber($number)
55 Returns the basenumber of $number if $number has a valid check
56 digit.
57
58 Return '' otherwise.
59
60 checkdigit($number)
61 Returns the checkdigit of $number if $number has a valid check
62 digit.
63
64 Return '' otherwise.
65
66 EXPORT
67 None by default.
68
70 Mathias Weidner, "<mamawe@cpan.org>"
71
73 perl, CheckDigits, www.pruefziffernberechnung.de.
74
75
76
77perl v5.28.1 2019-02-02Algorithm::CheckDigits::M23_002(3)