Algori...M10_005(3pm)

πŸ“¦
version 1.3.6 Β· 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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 🧚

  1. Beginning left all numbers are weighted alternatively 4 and 9. πŸ’…
  2. The sum of all products is computed. βž•
  3. 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 πŸ™ˆ)
  4. The check digit is the difference between 10 and 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