Algori...M10_005(3pm)
π Algori...M10_005 π
okay bestie, so this is the Algori...M10_005 page from the User Contributed Perl Documentation (man section 3pm, so it's a Perl module page) β¨ and it's literally about computing check digits for Deutsche Post Identcode/Leitcode (DE). Yes, the module name got truncated to Algori...M10_005 and yes we're keeping it exactly like that, no cap. π
πΈ NAME πΈ
CheckDigits::M10_005 β compute check digits for Deutsche Post Identcode/Leitcode (DE) π¦
β¨ SYNOPSIS β¨
use Algorithm::CheckDigits;
$ic = CheckDigits('identcode_dp');
if ($ic->is_valid('21.802 580.906 6')) {
# do something
}
$cn = $ic->complete('21.802 580.906');
# $cn = '21.802 580.9066'
$cd = $ic->checkdigit('21.802 580.906 6');
# $cd = '6'
$bn = $ic->basenumber('21.802 580.906 6');
# $bn = '21.802 580.906'
π DESCRIPTION π
ALGORITHM
the way this works is genuinely so simple, here's the whole thing π§
- Beginning left all numbers are weighted alternatively
4and9. π - The sum of all products is computed. β
- The sum of step 3 ist taken modulo
10. (yes, the page literally says "step 3" right there β we're not touching it, we're just reporting the lore π) - The check digit is the difference between
10and the number from step 3. π―
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. zero. niente. you get the vibes, not the symbols.
π AUTHOR π
Mathias Weidner, "<mamawe@cpan.org>"
π¦ SEE ALSO π¦
perl, CheckDigits, www.pruefziffernberechnung.de.
and that's the whole page bestie!! π this absolute icon dropped on 2022-10-13 with perl v5.36.0, courtesy of the User Contributed Perl Documentation β shoutout to the perl v5.36.0 era for carrying this whole thing, periodt. πβ¨ slay, go validate some Identcodes. π
π¦ 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