https://github.com/michal-josef-spacek/person-id-cz-rc
Perl class for Czech RC identification.
https://github.com/michal-josef-spacek/person-id-cz-rc
Last synced: 2 months ago
JSON representation
Perl class for Czech RC identification.
- Host: GitHub
- URL: https://github.com/michal-josef-spacek/person-id-cz-rc
- Owner: michal-josef-spacek
- License: bsd-2-clause
- Created: 2013-09-19T11:19:59.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-12-05T14:16:20.000Z (over 1 year ago)
- Last Synced: 2025-01-01T04:46:55.184Z (4 months ago)
- Language: Perl
- Size: 85 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
NAME
Person::ID::CZ::RC - Perl class for Czech RC identification.SYNOPSIS
use Person::ID::CZ::RC;my $obj = Person::ID::CZ::RC->new(%params);
my $alternate = $obj->alternate;
my $checksum = $obj->checksum;
my $day = $obj->day;
my $error = $obj->error;
my $is_valid = $obj->is_valid;
my $month = $obj->month;
my $rc = $obj->rc;
my $serial = $obj->serial;
my $sex = $obj->sex;
my $year = $obj->year;METHODS
"new"
my $obj = Person::ID::CZ::RC->new(%params);Constructor.
* "rc"
Input Czech RC identification.
It is required.
Returns instance of object.
"alternate"
my $alternate = $obj->alternate;Get flag, that means alternate RC identification.
Returns 0/1.
"checksum"
my $checksum = $obj->checksum;Get checksum.
Returns string with one number character or '-'.
"day"
my $day = $obj->day;Get day of birth.
Returns string with day.
"error"
my $error = $obj->error;Get error.
Returns error string or undef.
"is_valid"
my $is_valid = $obj->is_valid;Get flag, that means validity of rc identification.
Returns 0/1.
"month"
my $month = $obj->month;Get month of birth.
Returns string with month.
"rc"
my $rc = $obj->rc;Get rc identification.
Returns string with rc identification.
"serial"
my $serial = $obj->serial;Get serial part of rc identification.
Returns string with three numbers.
"sex"
my $sex = $obj->sex;Get flag, that means sex of person.
Returns male/female string.
"year"
my $year = $obj->year;Get year of birth.
Returns string with year.
ERRORS
new():
Parameter 'rc' is required.
From Class::Utils::set_params():
Unknown parameter '%s'.EXAMPLE1
use strict;
use warnings;use Person::ID::CZ::RC;
# Object.
my $obj = Person::ID::CZ::RC->new(
'rc' => '840501/1330',
);# Get error.
my $error = $obj->error || '-';# Print out.
print "Personal number: ".$obj->rc."\n";
print "Year: ".$obj->year."\n";
print "Month: ".$obj->month."\n";
print "Day: ".$obj->day."\n";
print "Sex: ".$obj->sex."\n";
print "Serial: ".$obj->serial."\n";
print "Checksum: ".$obj->checksum."\n";
print "Alternate: ".$obj->alternate."\n";
print "Valid: ".$obj->is_valid."\n";
print "Error: ".$error."\n";# Output:
# Personal number: 840501/1330
# Year: 1984
# Month: 05
# Day: 01
# Sex: male
# Serial: 133
# Checksum: 0
# Alternate: 0
# Valid: 1
# Error: -EXAMPLE2
use strict;
use warnings;use Person::ID::CZ::RC;
# Object.
my $obj = Person::ID::CZ::RC->new(
'rc' => '840230/1337',
);# Get error.
my $error = $obj->error || '-';# Print out.
print "Personal number: ".$obj->rc."\n";
print "Year: ".$obj->year."\n";
print "Month: ".$obj->month."\n";
print "Day: ".$obj->day."\n";
print "Sex: ".$obj->sex."\n";
print "Serial: ".$obj->serial."\n";
print "Checksum: ".$obj->checksum."\n";
print "Alternate: ".$obj->alternate."\n";
print "Valid: ".$obj->is_valid."\n";
print "Error: ".$error."\n";# Output:
# Personal number: 840230/1337
# Year: 1984
# Month: 02
# Day: 30
# Sex: male
# Serial: 133
# Checksum: 7
# Alternate: 0
# Valid: 0
# Error: Date isn't valid.EXAMPLE3
use strict;
use warnings;use Person::ID::CZ::RC;
# Object.
my $obj = Person::ID::CZ::RC->new(
'rc' => '840229/1330',
);# Get error.
my $error = $obj->error || '-';# Print out.
print "Personal number: ".$obj->rc."\n";
print "Year: ".$obj->year."\n";
print "Month: ".$obj->month."\n";
print "Day: ".$obj->day."\n";
print "Sex: ".$obj->sex."\n";
print "Serial: ".$obj->serial."\n";
print "Checksum: ".$obj->checksum."\n";
print "Alternate: ".$obj->alternate."\n";
print "Valid: ".$obj->is_valid."\n";
print "Error: ".$error."\n";# Output:
# Personal number: 840229/1330
# Year: 1984
# Month: 02
# Day: 29
# Sex: male
# Serial: 133
# Checksum: 0
# Alternate: 0
# Valid: 0
# Error: Checksum isn't valid.EXAMPLE4
use strict;
use warnings;use Person::ID::CZ::RC;
# Object.
my $obj = Person::ID::CZ::RC->new(
'rc' => '840229/133',
);# Get error.
my $error = $obj->error || '-';# Print out.
print "Personal number: ".$obj->rc."\n";
print "Year: ".$obj->year."\n";
print "Month: ".$obj->month."\n";
print "Day: ".$obj->day."\n";
print "Sex: ".$obj->sex."\n";
print "Serial: ".$obj->serial."\n";
print "Checksum: ".$obj->checksum."\n";
print "Alternate: ".$obj->alternate."\n";
print "Valid: ".$obj->is_valid."\n";
print "Error: ".$error."\n";# Output:
# Personal number: 840229/133
# Year: 1984
# Month: 02
# Day: 29
# Sex: male
# Serial: 133
# Checksum: -
# Alternate: 0
# Valid: 0
# Error: Format of rc identification hasn't checksum.EXAMPLE5
use strict;
use warnings;use Person::ID::CZ::RC;
# Object.
my $obj = Person::ID::CZ::RC->new(
'rc' => '840229|1330',
);# Get error.
my $error = $obj->error || '-';# Print out.
print "Personal number: ".$obj->rc."\n";
print "Year: ".$obj->year."\n";
print "Month: ".$obj->month."\n";
print "Day: ".$obj->day."\n";
print "Sex: ".$obj->sex."\n";
print "Serial: ".$obj->serial."\n";
print "Checksum: ".$obj->checksum."\n";
print "Alternate: ".$obj->alternate."\n";
print "Valid: ".$obj->is_valid."\n";
print "Error: ".$error."\n";# Output:
# Personal number: 840229|1330
# Year: -
# Month: -
# Day: -
# Sex: -
# Serial: -
# Checksum: -
# Alternate: -
# Valid: 0
# Error: Format of rc identification isn't valid.DEPENDENCIES
Class::Utils, DateTime, English, Error::Pure.SEE ALSO
Business::DK::CPR
Danish CPR (SSN) number generator/validatorNo::PersonNr
Check Norwegian Social security numbersPerson::ID::CZ::RC::Generator
Perl class for Czech RC identification generation.Se::PersonNr
Module for validating and generating a Swedish personnummer.REPOSITORY
AUTHOR
Michal Josef Špaček
LICENSE AND COPYRIGHT
© Michal Josef Špaček 2013-2023BSD 2-Clause License
VERSION
0.06