NAME
Is::Kennitala - Validate and process Icelandic identity numbers
SYNOPSIS
# Functional interface
use Is::Kennitala qw< :all >;
my $kt = '0902862349'; # Yours truly
if ( valid $kt ) {
# Extract YYYY-MM-DD
my $year = year $kt;
my $month = month $kt
my $day = day $kt;
# ...
}
# OO interface that doesn't pollute your namespace
use Is::Kennitala;
my $kt = Is::Kennitala->new( '0902862349' );
if ( $kt->valid and $kt->person ) {
printf "You are a Real Boy(TM) born on %d-%d-%d\n",
$kt->year, $kt->month, $kt->day;
} elsif ( $kt->valid and $kt->comany ) {
warn "Begone, you spawn of capitalims!";
} else {
die "EEEK!";
}
DESCRIPTION
A kennitala (Icelandic: identity number) is a 10 digit unique identity number given to persons and corporations in Iceland. This module provides an interface for validating these numbers and extracting information from them.
METHODS & FUNCTIONS
new
Optional constructor which takes a valid kennitala or a fragment as its argument. Returns an object that stringifies to whatever string is provided.
If a fragment is provided functions in this package that need information from the omitted part (such as "year") will not work.
valid
Takes a 9-10 character kennitala and returns true if its checksum is valid, false otherwise.
checksum
Takes a the first 8 characters of a kennitala and returns the 9th checksum digit.
person
Returns true if the kennitala belongs to an individual, false otherwise.
company
Returns true if the kennitala belongs to a company, false otherwise.
year
Return the four-digit year part of the kennitala. For this function to work a complete 10-digit number must have been provided.
month
Return the two-digit month part of the kennitala.
day
Return the two-digit day part of the kennitala.
CAVEATS
Only supports identity numbers assigned between the years 1800-2099
BUGS
Please report any bugs that aren't already listed at http://rt.cpan.org/Dist/Display.html?Queue=Is-Kennitala to http://rt.cpan.org/Public/Bug/Report.html?Queue=Is-Kennitala
SEE ALSO
http://www.hagstofa.is/?PageID=1474
AUTHOR
Ævar Arnfjörð Bjarmason <avar@cpan.org>
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.