1CheckDigits(3) User Contributed Perl Documentation CheckDigits(3)
2
3
4
6 Algorithm::CheckDigits - Perl extension to generate and test check
7 digits
8
10 perl -MAlgorithm::CheckDigits -e Algorithm::CheckDigits::print_methods
11
12 or
13
14 use Algorithm::CheckDigits;
15
16 @ml = Algorithm::CheckDigits->method_list();
17
18 $isbn = CheckDigits('ISBN');
19
20 if ($isbn->is_valid('3-930673-48-7')) {
21 # do something
22 }
23
24 $cn = $isbn->complete('3-930673-48'); # $cn = '3-930673-48-7'
25
26 $cd = $isbn->checkdigit('3-930673-48-7'); # $cd = '7'
27
28 $bn = $isbn->basenumber('3-930673-48-7'); # $bn = '3-930673-48'
29
31 This module provides a number of methods to test and generate check
32 digits. For more information have a look at the web site
33 www.pruefziffernberechnung.de (german).
34
36 CheckDigits($method)
37 Returns an object of an appropriate Algorithm::CheckDigits class for
38 the given algorithm.
39
40 Dies with an error message if called with an unknown algorithm.
41
42 See below for the available algorithms. Every object understands the
43 following methods:
44
45 is_valid($number)
46 Returns true or false if $number contains/contains no valid check
47 digit.
48
49 complete($number)
50 Returns a string representation of $number completed with the
51 appropriate check digit.
52
53 checkdigit($number)
54 Extracts the check digit from $number if $number contains a valid
55 check digit.
56
57 basenumber($number)
58 Extracts the basenumber from $number if $number contains a valid
59 check digit.
60
61 Algorithm::CheckDigits::method_list()
62 Returns a list of known methods for check digit computation.
63
64 Algorithm::CheckDigits::print_methods()
65 Returns a list of known methods for check digit computation.
66
67 You may use the following to find out which methods your version of
68 Algorithm::CheckDigits provides and where to look for further
69 information.
70
71 perl -MAlgorithm::CheckDigits -e Algorithm::CheckDigits::print_methods
72
73 CHECK SUM METHODS
74 At the moment these methods to compute check digits are provided:
75 (vatrn - VAT Return Number, in german ustid UmsatzSTeuer-ID)
76
77 m07-001
78 See Algorithm::CheckDigits::M07_001.
79
80 euronote, m09-001
81 European bank notes, see Algorithm::CheckDigits::M09_001.
82
83 amex, bahncard, diners, discover, enroute, eurocard, happydigits, isin,
84 jcb, klubkarstadt, mastercard, miles&more, visa, m09-001, imei, imeisv
85 See Algorithm::CheckDigits::M10_001.
86
87 siren, siret, m10-002
88 See Algorithm::CheckDigits::M10_002.
89
90 ismn, m10-003
91 See Algorithm::CheckDigits::M10_003.
92
93 ean, iln, isbn13, nve, 2aus5, m10-004
94 See Algorithm::CheckDigits::M10_004.
95
96 identcode_dp, leitcode_dp, m10-005
97 See Algorithm::CheckDigits::M10_005.
98
99 rentenversicherung, m10-006
100 See Algorithm::CheckDigits::M10_006.
101
102 sedol, m10-008
103 See Algorithm::CheckDigits::M10_008.
104
105 betriebsnummer, m10-009
106 See Algorithm::CheckDigits::M10_009.
107
108 postscheckkonti, m10-010
109 See Algorithm::CheckDigits::M10_010.
110
111 ups, m10-011
112 See Algorithm::CheckDigits::M10_011.
113
114 hkid, isbn, issn, nhs_gb, ustid_pt, vat_sl, wagonnr_br, m11-001
115 See Algorithm::CheckDigits::M11_001.
116
117 pzn, m11-002
118 See Algorithm::CheckDigits::M11_002.
119
120 pkz, m11-003
121 See Algorithm::CheckDigits::M11_003.
122
123 cpf, titulo_eleitor, m11-004
124 See Algorithm::CheckDigits::M11_004.
125
126 ccc_es, m11-006
127 See Algorithm::CheckDigits::M11_006.
128
129 ustid_fi, vatrn_fi, m11-007
130 See Algorithm::CheckDigits::M11_007.
131
132 ustid_dk, vatrn_dk, m11-008
133 See Algorithm::CheckDigits::M11_008.
134
135 nric_sg, m11-009
136 See Algorithm::CheckDigits::M11_009.
137
138 ahv_ch, m11-010
139 See Algorithm::CheckDigits::M11_010.
140
141 ustid_nl, vatrn_nl, m11-011
142 See Algorithm::CheckDigits::M11_011.
143
144 bwpk_de, m11-012
145 See Algorithm::CheckDigits::M11_012.
146
147 ustid_gr, vatrn_gr, m11-013
148 See Algorithm::CheckDigits::M11_013.
149
150 esr5_ch, m11-015
151 See Algorithm::CheckDigits::M11_015.
152
153 ustid_pl, vatrn_pl, m11-016
154 See Algorithm::CheckDigits::M11_016.
155
156 ecno, ec-no, einecs, elincs, m11-017
157 See Algorithm::CheckDigits::M11_017.
158
159 isan, m16-001
160 See Algorithm::CheckDigits::M16_001.
161
162 dni_es, m23-001
163 See Algorithm::CheckDigits::M23_001.
164
165 ustid_ie, vatrn_ie, m23-002
166 See Algorithm::CheckDigits::M23_002.
167
168 code_39, m43-001
169 See Algorithm::CheckDigits::M43_001.
170
171 ustid_lu, vatrn_lu, m89-001
172 See Algorithm::CheckDigits::M89_001.
173
174 ustid_be, vatrn_be, m97-001
175 See Algorithm::CheckDigits::M97_001.
176
177 iban, m97-002
178 See Algorithm::CheckDigits::M97_002.
179
180 upc, mbase-001
181 See Algorithm::CheckDigits::MBase_001.
182
183 blutbeutel, bzue_de, ustid_de, vatrn_de, mbase-002
184 See Algorithm::CheckDigits::MBase_002.
185
186 sici, mbase-003
187 See Algorithm::CheckDigits::MBase_003.
188
189 pa_de, mxx-001
190 See Algorithm::CheckDigits::MXX_001.
191
192 cas, mxx-002
193 See Algorithm::CheckDigits::MXX_002.
194
195 dem, mxx-003
196 Old german bank notes (DEM), see Algorithm::CheckDigits::MXX_003.
197
198 ustid_at, vatrn_at, mxx-004
199 See Algorithm::CheckDigits::MXX_004.
200
201 esr9_ch, mxx-005
202 See Algorithm::CheckDigits::MXX_005.
203
204 verhoeff, mxx-006
205 Verhoeff scheme, see Algorithm::CheckDigits::MXX_006 or
206 Algorithm::Verhoeff
207
208 EXPORT
209 None by default.
210
212 perl, www.pruefziffernberechnung.de.
213
215 Mathias Weidner, <mathias@weidner.in-bad-schmiedeberg.de>
216
218 Petri Oksanen made me aware that CheckDigits('IMEI') would invoke no
219 test at all since there was no entry for this in the methods hash.
220
222 Copyright 2004-2006 by Mathias Weidner
223
224 This library is free software; you can redistribute it and/or modify it
225 under the same terms as Perl itself.
226
227
228
229perl v5.12.1 2009-11-20 CheckDigits(3)