1Algorithm::CheckDigits:U:sMe1r1_C0o0n6t(r3i)buted Perl DAolcguomreintthamt:i:oCnheckDigits::M11_006(3)
2
3
4
6 CheckDigits::M11_006 - compute check digits for Codigo de Cuenta
7 Corriente (ES)
8
10 use Algorithm::CheckDigits;
11
12 $ccc = CheckDigits('ccc_es');
13
14 if ($ccc->is_valid('2420-0730-27-0050103552')) {
15 # do something
16 }
17
18 $cn = $ccc->complete('2420-0730- -0050103552');
19 # $cn = '2420-0730-27-0050103552'
20
21 $cd = $ccc->checkdigit('2420-0730-27-0050103552');
22 # $cd = '27'
23
24 $bn = $ccc->basenumber('2420-0730-27-0050103552');
25 # $bn = '2420-0730- -0050103552';
26
28 ALGORITHM
29 1. Beginning right all digits are weighted 6,3,7,9,10,5,8,4,2,1.
30
31 2. The weighted digits are added.
32
33 3. The sum of step 2 is taken modulo 11.
34
35 4. The checkdigit is 11 minus the sum from step 3.
36
37 If the difference is 10, the checkdigit is 1.
38
39 If the difference is 11, the checkdigit is 0.
40
41 METHODS
42 is_valid($number)
43 Returns true only if $number consists solely of numbers and hyphens
44 and the two digits in the middle are valid check digits according
45 to the algorithm given above.
46
47 Returns false otherwise,
48
49 complete($number)
50 The check digit for $number is computed and inserted into the
51 middle of $number.
52
53 Returns the complete number with check digit or '' if $number does
54 not consist solely of digits, hyphens and spaces.
55
56 basenumber($number)
57 Returns the basenumber of $number if $number has a valid check
58 digit.
59
60 Return '' otherwise.
61
62 checkdigit($number)
63 Returns the check digits of $number if $number has valid check
64 digits.
65
66 Return '' otherwise.
67
68 EXPORT
69 None by default.
70
72 Mathias Weidner, "<mamawe@cpan.org>"
73
75 perl, CheckDigits, www.pruefziffernberechnung.de,
76
77
78
79perl v5.28.0 2018-07-14Algorithm::CheckDigits::M11_006(3)