Perl module to test for correct pis numbers
use Business::BR::PIS; print "ok " if test_pis('121.51144.13-7'); # prints 'ok ' print "bad " unless test_pis('121.51144.13-0'); # prints 'bad '
This module handles \s-1PIS\s0 numbers, testing, formatting, etc.
\*(C`test_pis\*(C' is exported by default. \*(C`canon_pis\*(C', \*(C`format_pis\*(C', \*(C`parse_pis\*(C' and \*(C`random_pis\*(C' can be exported on demand.
A correct \s-1PIS\s0 number has a check digit which is computed from the base 10 first digits. Consider the \s-1PIS\s0 number written as 11 digits
c[1] c[2] c[3] c[4] c[5] c[6] c[7] c[8] c[9] c[10] dv[1]
To check whether a \s-1PIS\s0 is correct or not, it has to satisfy the check equation:
c[1]*3+c[2]*2+c[3]*9+c[4]*8+c[5]*7+ c[6]*6+c[7]*5+c[8]*4+c[9]*3+c[10]*2+dv[1] = 0 (mod 11) or = 1 (mod 11) (if dv[1]=0)
Absolute lack of documentation by now.
Please reports bugs via \s-1CPAN\s0 \s-1RT\s0, http://rt.cpan.org/NoAuth/Bugs.html?Dist=Business-BR-Ids By doing so, the author will receive your reports and patches, as well as the problem and solutions will be documented.
A. R. Ferreira, <[email protected]>
Copyright (C) 2005 by A. R. Ferreira
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.