Algori...M10_003(3pm)
๐ NAME ๐
CheckDigits::M10_003 โ the lil module that computes check digits for ISMN (that's the International Standard Music Number, bestie ๐ต).
โจ SYNOPSIS โจ
use Algorithm::CheckDigits;
$ismn = CheckDigits('ismn');
if ($ismn->is_valid('M-345-24680-5')) {
# do something
}
$cn = $ismn->complete('M-345-24680');
# $cn = 'M-345-24680-5'
$cd = $ismn->checkdigit('M-345-24680-5');
# $cd = '5'
$bn = $ismn->basenumber('M-345-24680-5');
# $bn = 'M-345-24680'
๐ธ DESCRIPTION ๐ธ
๐งฎ ALGORITHM ๐งฎ
- That leading
'M'gets the value 3. Then, starting from the left, every number gets weighted alternatingly 3 and 1. - Add up all those products. Sum city ๐
- The sum from step 3 gets taken modulo 10.
- The check digit is the difference between 10 and the number from step 3, taken modulo 10.
๐ซถ METHODS ๐ซถ
is_valid($number)โ returns true only if$numberis made up of nothing but numbers, and its last digit is a valid check digit according to the algorithm above. Anything else? It returns false. No cap.complete($number)โ the check digit for$numbergets computed and glued onto the end of$number. You get back the full number with its check digit โ or''if$numberisn't purely digits and spaces. Sorry babe ๐ญbasenumber($number)โ hands you the basenumber of$number, but only if$numberhas a valid check digit. Otherwise it returns''.checkdigit($number)โ gives you the checkdigit of$number, again only when$numberhas a valid check digit. Otherwise:''. That's it, that's the vibe.
๐ฆ EXPORT ๐ฆ
None by default. Nothing. Nada. Zero. ๐
๐ AUTHOR ๐
Mathias Weidner, "<mamawe@cpan.org>" โ absolute icon, we stan ๐
๐ฅ SEE ALSO ๐ฅ
perl, CheckDigits, www.pruefziffernberechnung.de.
okay that's the whole page, bestie, you ate it up fr fr โจ This little legend shipped as part of User Contributed Perl Documentation under the manual page Algori...M10_003(3pm), generated with perl v5.36.0 on 2022-10-13 ๐ Go forth and validate those music numbers ๐๐ต๐ฆ
๐ฆ where this page comes from
- ubuntu noble: libalgorithm-checkdigits-perl 1.3.6-2 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libalgorithm-checkdigits-perl 1.3.6-2 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libalgorithm-checkdigits-perl 1.3.6-2 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms