GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Business::IS::PIN(3) User Contributed Perl Documentation Business::IS::PIN(3)

Business::IS::PIN - Validate and process Icelandic PIN numbers (Icelandic: kennitölur)

    # Functional interface
    use Business::IS::PIN 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 Business::IS::PIN;

    my $kt = Business::IS::PIN->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->company) {
        warn "Begone, you spawn of capitalism!";
    } else {
        die "EEEK!";
    }

This module provides an interface for validating the syntax of and extracting information from Icelandic personal identification numbers (Icelandic: kennitala). These are unique 10-digit numbers assigned to all Icelandic citizens, foreign citizens with permanent residence and corporations (albeit with a slightly different format, see below).

The National Statistical Institute of Iceland (Icelandic: Hagstofa) - a goverment organization - handles the assignment of these numbers. This module will tell you whether the formatting of a given number is valid, not whether it was actually assigned to someone. For that you need to pay through the nose to the NSIoI, or cleverly leech on someone who is:)

None by default, every function in this package except for "new" can be exported individually, :all exports them all.

Optional constructor which takes a valid kennitala or a fragment of one 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.

Takes a 9-10 character kennitala and returns true if its checksum is valid, false otherwise.

Takes a the first 8 characters of a kennitala and returns the 9th checksum digit.

Returns true if the kennitala belongs to an individual, false otherwise.

Returns true if the kennitala belongs to a company, false otherwise.

Return the four-digit year part of the kennitala. For this function to work a complete 10-digit number must have been provided.

Return the two-digit month part of the kennitala.

Return the two-digit day part of the kennitala.

The format of an IPIN is relatively simple:

   DDMMYY-SSDC

Where DDMMYY is a two-digit day, month and year, SS is a pseudo-random serial number, D is the check digit computed from preceding part and C stands for the century and is not included when calculating the checksum digit - 8 for 1800s, and 9 and 0 for the 1900s and 2000s respectively. It is customary to place a dash between the first 6 and last 4 digits when formatting the number.

To compute the check digit from a given IPIN 0902862349 the following algorithm is used:

      0   9    0   2    8    6    2   3  4  9
    * 3   2    7   6    5    4    3   2
    = 0 + 18 + 0 + 12 + 40 + 24 + 6 + 6 = 106

    checkdigit = (11 - 106 % 11) % 11

I.e. each digit 1..8 is multiplied by 3..2, 7..2 respectively and the result of each multiplication added together to get 106. 106 is then used as the divend in a modulo operation with 11 as the divisor to get 7 which is then subtracted from 11 to get 4 - in this case the check digit, if the result had been 11 a second modulo operation 11 % 11 would have left us with 0.

Only supports identity numbers assigned between the years 1800-2099. Please resurrect the author when this becomes an issue.

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>

<http://www.hagstofa.is/?PageID=1474>

Ævar Arnfjörð Bjarmason <avar@cpan.org>

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2010-03-12 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.