Business::IBAN - Validate and generate IBANs
use Business::IBAN; use Locale::Country; my $cc = country2code('Germany'); my $iban = Business::IBAN->new(); # ---------- generate my $ib = $iban->getIBAN( { ISO => $cc, # or "DE", etc. BIC => 12345678, # Bank Identifier Code, meaning the BLZ # in Germany AC => "1234567890", }); # or my $ib = $iban->getIBAN( { ISO => "DE", BBAN => 123456781234567890, }); if ($ib) { print "IBAN is $ib\n"; } else { $iban->printError(); # or my @errors = $iban->getError(); # print your own error messages (for description of error- # codes see section ERROR-CODES } # ------------ validate if ($iban->valid($ib)) { # note: this also accepts IBANs in paper format with spaces added print "$ib is valid\n"; } else { $iban->printError(); }
With this module you can validate IBANs (International Bank Account Number) like "IBAN DE97123456781234567890" (ISO 13616). (Note: spaces between numbers are allowed.) Note that this dos not (and cannot) assure that the bank account exists or that the bank account number for the bank itself is valid. You can also create an IBAN if you supply
- your BBAN (Basic Bank Account Number), (or for germany your BLZ and account number are sufficient),
- and either your country code (ISO3166) or the english name for your country.
But note that only your bank is supposed to create your official IBAN.
To get your country code the module Locale::Country is required, which you can get from www.cpan.org. It's a standard module since perl-version 5.7.2. If you know your country code, you don't need the module.
None by default. All methods are accessed over the object.
You can print your own error-messages. The array you get from my @errors = $iban->getError(); are numbers which stand for the following errors:
0: No Country or Iso-Code supplied 1: No BBAN (Bank-Number) or Bank Identifier and Accountnumber supplied 2: Could not find country 3: IBAN must contain two-letter ISO-Code at the beginning 4: IBAN must only contain only alphanumerics after the ISO-code 5: IBAN is invalid
Please note that this program is intended to validate IBANs and generate them for you if you have your BBAN. It's not for generating valid numbers for illegal purposes. The algorithm is simple and publicly available for everyone. You can find informations about the IBAN at
Business::IBAN Version 0.06
Tina Mueller. tinita(at)cpan.org
To install Business::IBAN, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Business::IBAN
CPAN shell
perl -MCPAN -e shell install Business::IBAN
For more information on module installation, please visit the detailed CPAN module installation guide.