Algori...M07_001(3pm)
๐ CheckDigits::M07_001 โ it's giving check digits, modulo 7, method 1 ๐
okay bestie, sit down, hydrate, and let me tell you about CheckDigits::M07_001, a lil module living in the Algorithm::CheckDigits family (that's the 3pm perl manual situation, user contributed perl documentation, iykyk). It computes check digits using the modulo 7 method, version 1. She's small, she's mighty, she's iconic. ๐
โจ SYNOPSIS โจ
use Algorithm::CheckDigits;
$m001 = CheckDigits('m001');
if ($m001->is_valid('1234567892')) {
# do something
}
$cn = $m001->complete('123456789'); # $cn = '1234567892'
$cd = $m001->checkdigit('1234567892'); # $cd = '2'
$bn = $m001->basenumber('1234567892'); # $bn = '123456789'
literally that's it. that's the whole vibe. ๐ธ
๐ DESCRIPTION ๐
๐งฎ ALGORITHM ๐งฎ
lowkey the whole thing is four steps, no cap:
- All digits are added. ๐
- All digits at even positions are added.
- The sum of step 1 and 2 is taken modulo 7.
- This is the check digit. periodt. โจ
๐ซถ METHODS ๐ซถ
is_valid($number)โ spits out true only if$numberconsists solely of numbers and the last digit is a valid check digit according to the algorithm up there ๐. Any other situation? false. she's picky and honestly? valid.complete($number)โ computes the check digit for$numberand concatenates it right onto the end of$number. You get back the complete number with its check digit, orundefif$numberdoes not consist solely of digits. no digits, no deal. ๐basenumber($number)โ returns the basenumber of$numberif$numberhas a valid check digit. Otherwise you getundef. that's the whole tea. ๐checkdigit($number)โ returns the check digit belonging to$number, orundefif$numberdoes not consist solely of digits. ๐ฆ
๐ฆ EXPORT ๐ฆ
None by default. not a single thing, she's keeping it all to herself. ๐
๐ AUTHOR ๐
Mathias Weidner, "<mamawe@cpan.org>" โ the mastermind, the main character, the one who did that. ๐ฅ
๐ SEE ALSO ๐
perlwww.pruefziffernberechnung.de.
and that's the page fr fr ๐ this lil render was brought to you by perl v5.36.0, dated 2022-10-13 โ she's giving Algori...M07_001(3pm) and she ATE, no crumbs, bye bestie ๐โจ๐ฆ
๐ฆ 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