Sign in to PrePAN

Algorithm::Damm Damm check digit calculation



Implement the Damm check digit algorithm


See for details on this algorithm.

A couple of questions:

1) Is this a good namespace?

2) Any blatant issues found?


namespace sounds right. the wikipedia article says it's similar to the Verhoeff algorithm, which has an implementation in the same namespace:
Released to CPAN:

Review comments still very welcome :-)
I'd first modify the interface to match with (is_valid, complete, checkdigit, and basenumber), second allow both calling as function (`Algorithm::Damm::is_valid($number)`) and as method (`Algorithm::Damm->is_valid($number)` and $a->is_valid($number)` if you add a constructor `Algorithm::Damm->new`), and third rename it to `Algorithm::CheckDigit::Damm`. You could further ask Mathias Weidner, author of Algorithm::CheckDigits to implement a plugin mechanism, so `Algorith::CheckDigits->new('Damm')` loads your module.
Figures that I didn't wait long enough for comments before cpanning it :-)

Suggestions make sense. I will see if I can get a few properly shaped tuits to implement in the next few days.

Wonder how I missed the entire Algorithm::CheckDigits stuff.

The good about Perl: everyone can write a CPAN module, so you most likely find a module for your problem. The bad about Perl: everyone writes CPAN modules, so you unlikely find the right module for your problem.

Please sign up to post a review.