Algori...MXX_003(3pm)
π Algori...MXX_003 (3pm) π
okay bestie, pull up a chair because we're talking about CheckDigits::MXX_003 β it lives in the User Contributed Perl Documentation section of the manual, and it's a Perl module that handles check digits. slay. π
β¨ NAME β¨
CheckDigits::MXX_003 β she computes check digits for DEM. that's it, that's the job, and she does it flawlessly. periodt. π
β¨ SYNOPSIS β¨
here's the whole vibe, verbatim, don't touch a character:
use Algorithm::CheckDigits;
$dem = CheckDigits('dem');
if ($dem->is_valid('GD0645027K1')) {
# do something
}
$cn = $dem->complete('GD0645027K');
# $cn = 'GD0645027K1'
$cd = $dem->checkdigit('GD0645027K1');
# $cd = '1'
$bn = $dem->basenumber('GD0645027K1');
# $bn = 'GD0645027K'
so likeβ¦ you load the module, you grab a 'dem' checker, and then you just vibe with it. is it valid? complete it? pull the check digit? pull the base? all of it, no cap. π¦
β¨ DESCRIPTION β¨
π ALGORITHM π
ngl this one is a variation of the Verhoeff scheme β that's the whole teaser, and here's the step-by-step, zero steps skipped:
0β All letters are changed to numbers. every single one. π₯°1β All digits are permutated according to a permutation table.2β The permutated digits are combined using a dieeder table. The first with the second, the result with the third, this result with the fourth and so on. it just keeps folding in, one at a time, like a girl group adding members. β¨3β The result of the last combination in the dieeder table is in such a way combined that the result is0(zero). The number used for this combination is the checksum.
for details look at the source. that's what the docs say, and honestly? fair. π
π METHODS π
is_valid($number)
Returns true only if $number consists solely of numbers and the last digit is a valid check digit according to the algorithm given above.
Returns false otherwise,
complete($number)
The check digit for $number is computed and concatenated to the end of $number.
Returns the complete number with check digit or '' if $number does not consist solely of digits and spaces.
basenumber($number)
Returns the basenumber of $number if $number has a valid check digit.
Return '' otherwise.
checkdigit($number)
Returns the checkdigit of $number if $number has a valid check digit.
Return '' otherwise.
π EXPORT π
None by default. nothing sneaks into your namespace, she's polite like that. π
β¨ AUTHOR β¨
Mathias Weidner, "<mamawe@cpan.org>" β shoutout to the icon who built this. π
β¨ THANKS β¨
(the section is there, but there's nothing listed under it) β an empty flex, we respect it. π
β¨ SEE ALSO β¨
perlCheckDigitswww.pruefziffernberechnung.de
πΈ gentle reminder bestie: the docs literally say for details look at the source, so if you're deep in the dieeder table trenches, the source is your bestie too. π«Ά
and that's the whole page, mwah π
sign-off time β¨ β this gem came from the User Contributed Perl Documentation, and the footer tells us it's perl v5.36.0, dated 2022-10-13. iconic. ate. no notes. ππ
π¦ 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