1Algorithm::CheckDigits:U:sMe1r1_C0o1n6t(r3i)buted Perl DAolcguomreintthamt:i:oCnheckDigits::M11_016(3)
2
3
4
6 CheckDigits::M11_016 - compute check digits vor VAT Registration Number
7 (PL)
8
10 use Algorithm::CheckDigits;
11
12 $nip = CheckDigits('nip');
13
14 if ($nip->is_valid('8567346215')) {
15 # do something
16 }
17
18 $cn = $nip->complete('856734621');
19 # $cn = '8567346215'
20
21 $cd = $nip->checkdigit('856734621');
22 # $cd = '5'
23
24 $bn = $nip->basenumber('8567346215');
25 # $bn = '856734621';
26
28 ALGORITHM
29 1. Beginning left every digit is weighted with 6, 5, 7, 2, 3, 4, 5, 6,
30 7
31
32 2. The weighted digits are added.
33
34 3. The sum from step 2 is taken modulo 11.
35
36 4. The checkdigit is 11 minus the sum from step 3. Is the difference
37 10, the number won't be taken. If the difference is 11, the
38 checkdigit is 0.
39
40 METHODS
41 is_valid($number)
42 Returns true only if $number consists solely of numbers and the
43 rightmost digit is a valid check digit according to the algorithm
44 given above.
45
46 Returns false otherwise,
47
48 complete($number)
49 The check digit for $number is computed and appended to the end of
50 $number.
51
52 Returns the complete number with check digit or '' if $number does
53 not consist solely of digits, hyphens and spaces.
54
55 basenumber($number)
56 Returns the basenumber of $number if $number has a valid check
57 digit.
58
59 Return '' otherwise.
60
61 checkdigit($number)
62 Returns the check digits of $number if $number has valid check
63 digits.
64
65 Return '' otherwise.
66
67 EXPORT
68 None by default.
69
71 Mathias Weidner, "<mamawe@cpan.org>"
72
74 perl, CheckDigits, www.pruefziffernberechnung.de,
75 http://www.pruefziffernberechnung.de/U/USt-IdNr.shtml#PZPL (German),
76 http://wipos.p.lodz.pl/zylla/ut/translation.html#PZPL (English),
77 http://wipos.p.lodz.pl/zylla/ut/nip-rego.html (Polish)
78
79
80
81perl v5.28.0 2018-07-14Algorithm::CheckDigits::M11_016(3)