Algorithm-Damm
view release on metacpan or search on metacpan
Build.PL
Changes
ignore.txt
lib/Algorithm/Damm.pm
Makefile.PL
MANIFEST This list of files
README
t/00-load.t
t/01-interface.t
t/10-errors.t
t/11-good_and_bad.t
t/manifest.t
t/pod-coverage.t
t/pod.t
META.yml
---
name: Algorithm-Damm
version: 1.001.002
author:
- 'Brian T. Wightman <MidLifeXis@wightmanfam.org>'
abstract: Calculate the Damm error correction check digit.
license: perl
resources:
license: ~
configure_requires:
Module::Build: 0
requires:
perl: 5.6.0
build_requires:
Test::More: 0
provides:
NAME
Algorithm::Damm - Calculate the Damm error correction check digit.
SYNOPSIS
use Algorithm::Damm qw/check_digit is_valid/;
$c = check_digit("43881234567");
print "It works\n" if is_valid("43881234567$c");
DESCRIPTION
This module implements the Damm algorithm for calculating a check digit.
add an integration layer for this module to Algorithm::CheckDigits.
Algorithm::LUHN
Original code based on Algorithm::LUHN by Tim Ayers.
Math::CheckDigits
Slightly different approach to generating check digits.
Wikipedia
<http://en.wikipedia.org/wiki/Damm_algorithm> - Article explaining
the Damm error correction algorithm.
REPOSITORY
You can find the source at
<https://www.github.org/MidLifeXis/perl-algorithm-damm>.
BUGS
None known at this time, but feel free to submit them to RT or the issue
tracker for this source at GitHub.
AUTHOR
lib/Algorithm/Damm.pm view on Meta::CPAN
@ISA = qw/Exporter/;
@EXPORT = qw//;
@EXPORT_OK = qw/check_digit is_valid/;
$VERSION = '1.001.002';
=pod
=head1 NAME
Algorithm::Damm - Calculate the Damm error correction check digit.
=head1 SYNOPSIS
use Algorithm::Damm qw/check_digit is_valid/;
$c = check_digit("43881234567");
print "It works\n" if is_valid("43881234567$c");
=head1 DESCRIPTION
lib/Algorithm/Damm.pm view on Meta::CPAN
Original code based on L<Algorithm::LUHN> by Tim Ayers.
=item Math::CheckDigits
Slightly different approach to generating check digits.
=item Wikipedia
L<http://en.wikipedia.org/wiki/Damm_algorithm> - Article explaining
the Damm error correction algorithm.
=back
=head1 REPOSITORY
You can find the source at
L<https://www.github.org/MidLifeXis/perl-algorithm-damm>.
=head1 BUGS
t/10-errors.t view on Meta::CPAN
no warnings 'uninitialized';
use Test::More;
use Algorithm::Damm qw/is_valid check_digit/;
my $tests;
plan tests => $tests;
my @check_digit_errors;
BEGIN {
@check_digit_errors = (
'',
undef,
'a',
'123a',
);
$tests += @check_digit_errors;
}
is( check_digit( $_ ), undef, "check_digit( $_ ) => undef" )
for @check_digit_errors;
my @check_digit_non_errors;
BEGIN {
@check_digit_non_errors = (
'0' .. '9'
);
$tests += @check_digit_non_errors;
}
isnt( check_digit( $_ ), undef, "check_digit( $_ ) not undef" )
for @check_digit_non_errors;
my @is_valid_errors;
BEGIN {
@is_valid_errors = (
'',
undef,
'a',
'aa',
'1',
'123a',
);
$tests += @is_valid_errors;
}
is( is_valid( $_ ), undef, "is_valid( $_ ) => undef" )
for @is_valid_errors;
my @is_valid_non_errors;
BEGIN {
@is_valid_non_errors = (
'11',
'00',
);
$tests += @is_valid_non_errors;
}
isnt( is_valid( $_ ), undef, "is_valid( $_ ) not undef" )
for @is_valid_non_errors;
( run in 0.670 second using v1.01-cache-2.11-cpan-65fba6d93b7 )