The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Business::IBAN::Database - Simple database for checking IBANs

SYNOPSIS

    use Business::IBAN::Database;

    my $iso3166a2 = uc substr $iban, 0, 2;
    if (!exists iban_db->{$iso3166a2}) {
        die "Countrycode '$iso3166a2' not in IBAN.\n";
    }
    if (length($iban) != iban_db->{$iso3166a2}{iban_length}) {
        die "Invalid length for '$iban'.\n";
    }
    if ($iban !~ iban_db->{$iso3166a2}{iban_structure}) {
        die "Invalid pattern for '$iban'.\n";
    }
    if (mod97(numify_iban($iban)) != 1) {
        die "Invalid checksum for '$iban'.\n";
    }

DESCRIPTION

This module was originally generated from the IBAN_Registry.pdf document supplied by SWIFT version 45 (April 2013) and updated to version 54 (January 2015).

All functions are exported by default.

iban_db()

Returns a reference to the "database" of known IBAN entities, keyed on the two letter code for participating countries (See ISO 3166 alpha 2 codes).

numify_iban($iban)

Put the first four characters at the end of the string. Transform all letters into numbers. This results in a string of digits [0-9] that can be used as a number.

mod97($number)

Returns the remainder of division by 97.

STUFF

(c) MMXIII-MMXV - Abe Timmerman <abeltje@cpan.org>