1Algorithm::CheckDigits:U:sMe1r1_C0o0n7t(r3i)buted Perl DAolcguomreintthamt:i:oCnheckDigits::M11_007(3)
2
3
4
6 CheckDigits::M11_007 - compute check digits for VAT Registration Number
7 (FI)
8
10 use Algorithm::CheckDigits;
11
12 $ustid = CheckDigits('ustid_fi');
13
14 if ($ustid->is_valid('13669598')) {
15 # do something
16 }
17
18 $cn = $ustid->complete('1366959');
19 # $cn = '13669598'
20
21 $cd = $ustid->checkdigit('13669598');
22 # $cd = '8'
23
24 $bn = $ustid->basenumber('13669598');
25 # $bn = '1366959';
26
28 ALGORITHM
29 1. Beginning left every digit is weighted with 7,9,10,5,8,4,2.
30
31 2. The weighted digits are added.
32
33 3. The sum from step 2 is taken modulo 11.
34
35 4. The checkdigit is 11 minus the sum from step 3. Is the difference
36 10, the number won't be taken. If the difference is 11, the
37 checkdigit is 0.
38
39 METHODS
40 is_valid($number)
41 Returns true only if $number consists solely of digits and the
42 rightmost digit is a valid check digit according to the algorithm
43 given above.
44
45 Returns false otherwise,
46
47 complete($number)
48 The check digit for $number is computed and appended to the end of
49 $number.
50
51 Returns the complete number with check digit or '' if $number does
52 not consist solely of digits.
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 check digits of $number if $number has valid check
62 digits.
63
64 Return '' otherwise.
65
66 EXPORT
67 None by default.
68
70 Mathias Weidner, "<mamawe@cpan.org>"
71
73 perl, CheckDigits,
74 http://www.pruefziffernberechnung.de/U/USt-IdNr.shtml#PZFI (german)
75
76
77
78perl v5.34.0 2022-01-20Algorithm::CheckDigits::M11_007(3)