1CheckDigits::M10_008(3)User Contributed Perl DocumentatioCnheckDigits::M10_008(3)
2
3
4
6 CheckDigits::M10_008 - compute check digits for Sedol (GB)
7
9 use Algorithm::CheckDigits;
10
11 $sedol = CheckDigits('sedol');
12
13 if ($sedol->is_valid('0123457')) {
14 # do something
15 }
16
17 $cn = $sedol->complete('012345');
18 # $cn = '0123457'
19
20 $cd = $sedol->checkdigit('0123457');
21 # $cd = '7'
22
23 $bn = $sedol->basenumber('0123457');
24 # $bn = '012345'
25
27 ALGORITHM
28 1. Beginning left all numbers are weighted with 1,3,1,7,3,9 and 1
29 (checkdigit)
30
31 2. The sum of all products is computed.
32
33 3. The check digit is the difference of the sum from step 3 to the
34 next multiple of 10.
35
36 METHODS
37 is_valid($number)
38 Returns true only if $number consists solely of numbers and the
39 last digit is a valid check digit according to the algorithm given
40 above.
41
42 Returns false otherwise,
43
44 complete($number)
45 The check digit for $number is computed and concatenated to the end
46 of $number.
47
48 Returns the complete number with check digit or '' if $number does
49 not consist solely of digits and spaces.
50
51 basenumber($number)
52 Returns the basenumber of $number if $number has a valid check
53 digit.
54
55 Return '' otherwise.
56
57 checkdigit($number)
58 Returns the checkdigit of $number if $number has a valid check
59 digit.
60
61 Return '' otherwise.
62
63 EXPORT
64 None by default.
65
67 Mathias Weidner, <mathias@weidner.in-bad-schmiedeberg.de>
68
70 perl, CheckDigits, www.pruefziffernberechnung.de.
71
72
73
74perl v5.12.1 2009-11-20 CheckDigits::M10_008(3)