23 Jan 2011 13:33:01 UTC
- Distribution: Business-RO-CNP
- Module version: 0.03
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (1)
- Testers (400 / 369 / 16)
- KwaliteeBus factor: 0
- 50.00% Coverage
- License: perl_5
- Perl: v5.8.8
- Activity24 month
- Download (12.12KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:1 non-PAUSE userTEDDY Octavian Râşniţăand 1 contributors
- Octavian Rasnita
- BUGS AND LIMITATIONS
- CONFIGURATION AND ENVIRONMENT
- LICENSE AND COPYRIGHT
Business::RO::CNP - Romanian CNP validation
use Business::RO::CNP; my $cnp = Business::RO::CNP->new(cnp => 1040229319996); #or: my $cnp = Business::RO::CNP->new(1040229319996); print $cnp->valid ? "The CNP is valid" : "The CNP is not valid";
This module checks the validation of CNP (personal numeric code) of Romania's citizens and offers information about the person.
This method returns 1 if the CNP is valid or 0 otherwise.
This method returns 'm' if the person is a male or 'f' if is a female.
The method returns 'unknown' if the sex id of the person (the first digit in the CNP) is 9 (for non-romanian citizens).
When the first digit of the CNP is 1, 3, 5 or 7, this method returns 'm' and when it is 2, 4, 6 or 8, this method returns 'f'.
The method returns the first digit of the CNP. This digit is odd for men and even for women. It is 1 or 2 for those born between January 1 1900 and December 31 1999, 3 or 4 for those born between January 1 1800 and December 31 1899, 5 or 6 for those born between January 1 2000 and December 31 2099 and 7 or 8 for foreign citizens resident in Romania.
The sex id 9 is also reserved for foreign citizens.
This method returns a DateTime object that holds the birth day of the person so you can call any DateTime methods on it.
print $cnp->birthday; print $cnp->birthday->ymd; print $cnp->birthday->strftime('%d %m %y'); print $cnp->birthday->set_locale('ro')->month_name;
Check the DateTime module for finding out what methods you can use with this object.
This method returns the county where the person was born or where he received the CNP.
This method returns the county ID which is the pair of digits 8 and 9 in the CNP.
Bucharest has the ID 40 but its sectors also have their own IDs.
This method returns the last digit in the CNP and represents a pre-calculated value based on the first 12 digits of the CNP.
This method calculates the checksum from the first 12 digits of the CNP and it should be equal to the result of the checksum method in order to prove that the CNP is valid.
This method returns the CNP given as parameter to the object constructor.
This method returns the 3-digit order number from the CNP.
This method returns the century in which the person was born.
<orasnita at gmail.com>
No known incompatibilities.
Please report any bugs or feature requests to
bug-business-ro-cnp at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Business-RO-CNP. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
No configuration is necessary.
You can find documentation for this module with the perldoc command.
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
Copyright 2010 Octavian Rasnita.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
Module Install Instructions
To install Business::RO::CNP, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Business::RO::CNP
For more information on module installation, please visit the detailed CPAN module installation guide.