DOKK / manpages / debian 10 / libalgorithm-checkdigits-perl / Algorithm::CheckDigits.3pm.en
CheckDigits(3pm) User Contributed Perl Documentation CheckDigits(3pm)

Algorithm::CheckDigits - Perl extension to generate and test check digits

  perl -MAlgorithm::CheckDigits -e Algorithm::CheckDigits::print_methods

or

  use Algorithm::CheckDigits;
  
  @ml = Algorithm::CheckDigits->method_list();
  $isbn = CheckDigits('ISBN');
  if ($isbn->is_valid('3-930673-48-7')) {
        # do something
  }
  $cn = $isbn->complete('3-930673-48');     # $cn = '3-930673-48-7'
  $cd = $isbn->checkdigit('3-930673-48-7'); # $cd = '7'
  $bn = $isbn->basenumber('3-930673-48-7'); # $bn = '3-930673-48'

This module provides a number of methods to test and generate check digits. For more information have a look at the web site www.pruefziffernberechnung.de (german).

Returns an object of an appropriate Algorithm::CheckDigits class for the given algorithm.

Dies with an error message if called with an unknown algorithm.

See below for the available algorithms. Every object understands the following methods:

Returns true or false if $number contains/contains no valid check digit.
Returns a string representation of $number completed with the appropriate check digit.
Extracts the check digit from $number if $number contains a valid check digit.
Extracts the basenumber from $number if $number contains a valid check digit.

Algorithm::CheckDigits::method_list()

Returns a list of known methods for check digit computation.

Algorithm::CheckDigits::print_methods()

Returns a list of known methods for check digit computation.

You may use the following to find out which methods your version of Algorithm::CheckDigits provides and where to look for further information.

 perl -MAlgorithm::CheckDigits -e Algorithm::CheckDigits::print_methods

CHECK SUM METHODS

At the moment these methods to compute check digits are provided: (vatrn - VAT Return Number, in german ustid UmsatzSTeuer-ID)

See Algorithm::CheckDigits::M07_001.
European bank notes, see Algorithm::CheckDigits::M09_001.
See Algorithm::CheckDigits::M10_001.
See Algorithm::CheckDigits::M10_002.
See Algorithm::CheckDigits::M10_003.
See Algorithm::CheckDigits::M10_004.
See Algorithm::CheckDigits::M10_005.
See Algorithm::CheckDigits::M10_006.
See Algorithm::CheckDigits::M10_008.
See Algorithm::CheckDigits::M10_009.
See Algorithm::CheckDigits::M10_010.
See Algorithm::CheckDigits::M10_011.
See Algorithm::CheckDigits::M11_001.
See Algorithm::CheckDigits::M11_002.
See Algorithm::CheckDigits::M11_003.
See Algorithm::CheckDigits::M11_004.
See Algorithm::CheckDigits::M11_006.
See Algorithm::CheckDigits::M11_007.
See Algorithm::CheckDigits::M11_008.
See Algorithm::CheckDigits::M11_009.
See Algorithm::CheckDigits::M11_010.
See Algorithm::CheckDigits::M11_011.
See Algorithm::CheckDigits::M11_012.
See Algorithm::CheckDigits::M11_013.
See Algorithm::CheckDigits::M11_015.
See Algorithm::CheckDigits::M11_016.
See Algorithm::CheckDigits::M11_017.
See Algorithm::CheckDigits::M16_001.
See Algorithm::CheckDigits::M23_001.
See Algorithm::CheckDigits::M23_002.
See Algorithm::CheckDigits::M43_001.
See Algorithm::CheckDigits::M89_001.
See Algorithm::CheckDigits::M97_001.
See Algorithm::CheckDigits::M97_002.
See Algorithm::CheckDigits::MBase_001.
See Algorithm::CheckDigits::MBase_002.
See Algorithm::CheckDigits::MBase_003.
See Algorithm::CheckDigits::MXX_001.
See Algorithm::CheckDigits::MXX_002.
Old german bank notes (DEM), see Algorithm::CheckDigits::MXX_003.
See Algorithm::CheckDigits::MXX_004.
See Algorithm::CheckDigits::MXX_005.
Verhoeff scheme, see Algorithm::CheckDigits::MXX_006 or Algorithm::Verhoeff

EXPORT

None by default.

perl, www.pruefziffernberechnung.de.

Mathias Weidner, <mathias@weidner.in-bad-schmiedeberg.de>

Petri Oksanen made me aware that CheckDigits('IMEI') would invoke no test at all since there was no entry for this in the methods hash.

Copyright 2004-2006 by Mathias Weidner

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2008-06-06 perl v5.10.0