Business::PT::NIF - Validate Portuguese NIF (Número Fiscal de Contribuinte)
Version 0.01
use Business::PT::NIF; if ( valid_nif($nif) ) { # ... }
Validates Portuguese NIF's.
Returns a true value if the validation succeeds, a false one otherwise.
Currently, validation is done only by the control digit, as follows:
1) NIF is matched with /^\d{9}$/ (nine consecutive digits with nothing more) 2) Control digit (last one, the ninth) is removed and store 3) First digit is multiplied by 9, second by 8, third by 7, fourth by 6, fifth by 5, sixth by 4, seventh by 3, eighth by 2 4) All the results of the multiplication are summed 5) Modulo of the sum by 11 is found 6) Complement of the sum by 11 is found 7) Control digit is compared to said complement
Example for NIF 136695973:
1) NIF is matched agains /^\d{9}$/, test passes 2) Control digit is 3 (last digit) 3) Multiplication: 1*9, 3*8, 6*7, 6*6, 9*5, 5*4, 9*3, 7*2 4) Sum: 217 5) 217 % 11 = 8 6) 11 - 8 = 3 7) 3 == 3, test passes
When the complement (the result of step 6) is greater than 9, the number is assumed to be 0.
Jose Castro, <cog at cpan.org>
<cog at cpan.org>
Please report any bugs or feature requests to bug-business-pt-nif at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Business-PT-NIF. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-business-pt-nif at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Business::PT::NIF
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Business-PT-NIF
CPAN Ratings
http://cpanratings.perl.org/d/Business-PT-NIF
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Business-PT-NIF
Search CPAN
http://search.cpan.org/dist/Business-PT-NIF
http://chemeng.p.lodz.pl/zylla/ut/translation.html#PT
Copyright 2005 Jose Castro, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in '(Número'. Assuming CP1252
To install Business::PT::NIF, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Business::PT::NIF
CPAN shell
perl -MCPAN -e shell install Business::PT::NIF
For more information on module installation, please visit the detailed CPAN module installation guide.