Algorithm-CheckDigits
view release on metacpan or search on metacpan
lib/Algorithm/CheckDigits.pm view on Meta::CPAN
=back
=head2 Algorithm::CheckDigits::plug_in($module, $description, $prefkey)
Register a module that provides the same four methods as above. This function
returns a handle with which the registered module can be instantiated.
The first argument C<$module> is the module to be used for this plugin. This
argument is mandatory. Do not register 'Algorithm::CheckDigits'.
The second argument is a short description of the algorithm. If it is omitted,
the string C<algorithm of module $module> will be taken.
The third argument is the preferred key for this algorithm. The C<plug_in()>
function does not guarantee to register the algorithm with this key. Instead
it returns the key under which the algorithm is registered.
See L</"REGISTERING PLUGINS"> for more information on registering plugins.
=head2 Algorithm::CheckDigits::method_list()
lib/Algorithm/CheckDigits/M11_006.pm view on Meta::CPAN
my $calc = sub {
my @digits = split(//,shift);
my $sum = 0;
for (my $i = 0; $i <= $#digits; $i++) {
$sum += $weight[$i] * $digits[$#digits - $i];
}
$sum %= 11;
return $sum ? 11 - $sum : 0;
};
my $first = $calc->($bank);
my $second = $calc->($account);
return sprintf("%d%d",$first,$second);
} # _compute_checkdigit()
# Preloaded methods go here.
1;
__END__
=encoding iso-8859-1
=head1 NAME
lib/Algorithm/CheckDigits/MXX_002.pm view on Meta::CPAN
# $bn = '1333-74-'
=head1 DESCRIPTION
=head2 ALGORITHM
=over 4
=item 1
Beginning right with the second digit all digits are weighted
ascending starting with 1.
=item 2
The sum of those products is computed.
=item 3
The checksum is the last digit of the sum from step 2 (modulo 10).
lib/Algorithm/CheckDigits/MXX_003.pm view on Meta::CPAN
All letters are changed to numbers.
=item S<1>
All digits are permutated according to a permutation table.
=item S<2>
The permutated digits are combined using a diëder table. The first
with the second, the result with the third, this result with the
fourth and so on.
=item S<3>
The result of the last combination in the diëder table is in such a
way combined that the result is 0 (zero). The number used for this
combination is the checksum.
=back
lib/Algorithm/CheckDigits/MXX_006.pm view on Meta::CPAN
=over 4
=item 1
Right to left all digits are permutated according to a permutation table.
=item 2
The permutated digits are combined using a diëder table. The first
with the second, the result with the third, this result with the
fourth and so on.
=item 3
The result of the last combination in the diëder table is in such a
way combined that the result is 0 (zero). The number used for this
combination is the checksum.
=back
( run in 0.751 second using v1.01-cache-2.11-cpan-39bf76dae61 )