1Algorithm::CheckDigits:U:sMe1r1_C0o0n8t(r3i)buted Perl DAolcguomreintthamt:i:oCnheckDigits::M11_008(3)
2
3
4
6 CheckDigits::M11_008 - compute check digits for VAT Registration Number
7 (DK)
8
10 use Algorithm::CheckDigits;
11
12 $ustid = CheckDigits('ustid_dk');
13
14 if ($ustid->is_valid('13585628')) {
15 # do something
16 }
17
18 $cn = $ustid->complete('1358562');
19 # $cn = '13585628'
20
21 $cd = $ustid->checkdigit('13585628');
22 # $cd = '8'
23
24 $bn = $ustid->basenumber('13585628');
25 # $bn = '1358562';
26
28 ALGORITHM
29 1. Beginning left every digit is weighted with 2, 7, 6, 5, 4, 3, 2, 1
30
31 2. The weighted digits are added.
32
33 3. The sum from step 2 is taken modulo 11.
34
35 4. The number is valid if the sum from step 3 is zero (0).
36
37 METHODS
38 is_valid($number)
39 Returns true only if $number consists solely of numbers and the sum
40 computed according to the algorithm given above is 0.
41
42 Returns false otherwise,
43
44 complete($number)
45 Returns $number if $number is valid according to the algorithm
46 given above.
47
48 Return '' otherwise.
49
50 basenumber($number)
51 Returns $number if $number is valid according to the algorithm
52 given above.
53
54 Return '' otherwise.
55
56 checkdigit($number)
57 Returns '' if $number is valid.
58
59 Return undef otherwise.
60
61 EXPORT
62 None by default.
63
65 Mathias Weidner, "<mamawe@cpan.org>"
66
68 perl, CheckDigits, www.pruefziffernberechnung.de,
69
70
71
72perl v5.30.0 2019-07-26Algorithm::CheckDigits::M11_008(3)