1Algorithm::CheckDigits:U:sMe2r3_C0o0n1t(r3i)buted Perl DAolcguomreintthamt:i:oCnheckDigits::M23_001(3)
2
3
4
6 CheckDigits::M23_001 - compute check digits for DNI (ES)
7
9 use Algorithm::CheckDigits;
10
11 $dni = CheckDigits('dni_es');
12
13 if ($dni->is_valid('54362315K')) {
14 # do something
15 }
16
17 $cn = $dni->complete('54362315');
18 # $cn = '54362315K'
19
20 $cd = $dni->checkdigit('54362315K');
21 # $cd = 'K'
22
23 $bn = $dni->basenumber('54362315K');
24 # $bn = '54362315'
25
27 ALGORITHM
28 1. The checkdigit is the whole number taken modulo 23 and coded
29 according to a keytable.
30
31 METHODS
32 is_valid($number)
33 Returns true only if $number consists solely of numbers and the
34 last digit is a valid check digit according to the algorithm given
35 above.
36
37 Returns false otherwise,
38
39 complete($number)
40 The check digit for $number is computed and concatenated to the end
41 of $number.
42
43 Returns the complete number with check digit or '' if $number does
44 not consist solely of digits and spaces.
45
46 basenumber($number)
47 Returns the basenumber of $number if $number has a valid check
48 digit.
49
50 Return '' otherwise.
51
52 checkdigit($number)
53 Returns the checkdigit of $number if $number has a valid check
54 digit.
55
56 Return '' otherwise.
57
58 EXPORT
59 None by default.
60
62 Mathias Weidner, "<mamawe@cpan.org>"
63
65 perl, CheckDigits, www.pruefziffernberechnung.de.
66
67
68
69perl v5.32.0 2020-07-28Algorithm::CheckDigits::M23_001(3)