Algori...M07_001(3pm)

๐Ÿ“ฆ
version 1.3.6 ยท 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

๐Ÿ’– 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:

  1. All digits are added. ๐Ÿ’…
  2. All digits at even positions are added.
  3. The sum of step 1 and 2 is taken modulo 7.
  4. This is the check digit. periodt. โœจ

๐Ÿซถ METHODS ๐Ÿซถ

  • is_valid($number) โ€” spits out true only if $number consists 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 $number and concatenates it right onto the end of $number. You get back the complete number with its check digit, or undef if $number does not consist solely of digits. no digits, no deal. ๐Ÿ’€
  • basenumber($number) โ€” returns the basenumber of $number if $number has a valid check digit. Otherwise you get undef. that's the whole tea. ๐Ÿ“
  • checkdigit($number) โ€” returns the check digit belonging to $number, or undef if $number does 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 ๐ŸŒŸ

  • perl
  • www.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