1Algorithm::CheckDigits:U:sMeBrasCeo_n0t0r3i(b3u)ted PerlAlDgoocruimtehnmt:a:tCihoenckDigits::MBase_003(3)
2
3
4

NAME

6       CheckDigits::MBase_003 - compute check digits for SICI (Serial Item and
7       Contribution Identifier)
8

SYNOPSIS

10         use Algorithm::CheckDigits;
11
12         $sici = CheckDigits('sici');
13
14         if ($sici->is_valid('0784-8679(20040308)6:<138>2.0.TX;2-H')) {
15               # do something
16         }
17
18         $cn = $sici->complete('0784-8679(20040308)6:<138>2.0.TX;2-');
19         # $cn = '0784-8679(20040308)6:<138>2.0.TX;2-H'
20
21         $cd = $sici->checkdigit('0784-8679(20040308)6:<138>2.0.TX;2-H');
22         # $cd = 'H'
23
24         $bn = $sici->basenumber('0784-8679(20040308)6:<138>2.0.TX;2-H');
25         # $bn = '0784-8679(20040308)6:<138>2.0.TX;2-';
26

DESCRIPTION

28   ALGORITHM
29       0   In the string describing the number all letters (A-Z) are replaced
30           with numbers 10-35 accordingly. All other non-numbers are replaced
31           by 36.
32
33       1   Beginning right the numbers at all odd positions are added.
34
35       2   The sum from step 1 is multiplied by 3.
36
37       3   Beginning right the numbers at all even positions are added.
38
39       4   The sums from step 2 and 3 are added.
40
41       5   The sum from step 4 is taken modulo 37.
42
43       6   The checksum is 37 minus the sum from step 5 where numbers from 10
44           to 35 are represented by 'A' to 'Z' accordingly and 36 is
45           represented by '#'.
46
47   METHODS
48       is_valid($number)
49           Returns true only if the last letter is a valid check letter
50           according to the algorithm given above.
51
52           Returns false otherwise,
53
54       complete($number)
55           The check letter for $number is computed and appended the end of
56           $number.
57
58           Returns the complete number with check letter or ''.
59
60       basenumber($number)
61           Returns the basenumber of $number if $number has a valid check
62           digit.
63
64           Return '' otherwise.
65
66       checkdigit($number)
67           Returns the check letter of $number if $number has valid check
68           digits.
69
70           Return '' otherwise.
71
72   EXPORT
73       None by default.
74

AUTHOR

76       Mathias Weidner, "<mamawe@cpan.org>"
77

SEE ALSO

79       perl, CheckDigits, www.pruefziffernberechnung.de,
80       http://sunsite.berkeley.edu/SICI/sici.pdf
81
82
83
84perl v5.36.0                      2023-01-1A9lgorithm::CheckDigits::MBase_003(3)
Impressum