use Business::DE::KontoCheck;
my $kcheck = Business::DE::KontoCheck->new(%hash);
where %hash can have zero, one or more of the following entries:
BLZFILE => '/path/to/BLZ.dat'
MODE_BLZ_FILE => 'BANK' # either 'BANK', 'POST' or 'MINIMAL'
e.g.:
my $kcheck = Business::DE::KontoCheck->new(
BLZFILE => '/path/to/BLZ.dat',
MODE_BLZ_FILE => 'BANK',
);
If the BLZ-file is from POSTBANK, MODE_BLZ_FILE has to be 'POST'.
If the file is from the BUNDESBANK, it'S 'BANK'.
Set MODE_BLZ_FILE to 'MINIMAL' if you have a converted BLZ-file
(see below at Section "CACHING, SPEED-UPS")
my $konto = $kcheck->check(%hash);
# where %hash can have zero, one or more of the following entries:
# BLZ => 12345678
# KONTONR => 1234567890
# e.g.:
my $konto = $kcheck->check(BLZ => 12345678, KONTONR => 1234567890);
if (my $res = $konto->check(%hash)) {
# BLZ/account-number is okay
}
elsif (!defined $res) {
# account number is invalid
}
else {
# there were some other errors
$konto->printErrors();
}
check() returns 1 for success and 0 or undef for failure.
If the input was okay but the account number is invalid it
returns undef; in case of any other error it returns 0.
So you should check
In case of
failure you can do $konto->printError() to see why it failed.
Alternatively you can get errorcodes with:

If this script is running as a daemon or within mod_perl it would be rather slow because it has to read in the BLZ-file every time. You can speed this up by either doing:

$Business::DE::KontoCheck::CACHE_ON = 1; # DEFAULT is 1
This caches a BLZ, so if this BLZ is asked for a second
time the file doesn't have to be opened.

or

$Business::DE::KontoCheck::CACHE_ALL = 1; # DEFAULT is 0
This will read the whole BLZ-file at startup (when creating a
new Business::DE::KontoCheck-Object) and will
cache the method for every BLZ, so that the file will
not be opened any more.
The hash which holds the cached BLZs will have about
5000 entries at the moment.
So if you run this within mod_perl, for example, you can do
at startup:
use Business::DE::KontoCheck;
$Business::DE::KontoCheck::CACHE_ALL = 1;
my $kcheck = Business::DE::KontoCheck->new(
BLZFILE => "path/to/blzpc.txt",
MODE_BLZ_FILE => 'BANK'
);
and then make this $kcheck-Object available for the apache-childs
and call:
my $konto = $kcheck->check(BLZ=>$blz, KONTONR=>$kontonr);
if (my $res = $konto->check()) {
...
}
You also have the possibility to make the BLZ-file much smaller
(about 2% of the size) by using the tools/convert.pl script.
Just call the script to get instructions.
If you are using this file as BLZ-source, the MODE_BLZ_FILE
has to be: 'MINIMAL'.
my $kcheck = Business::DE::KontoCheck->new(
BLZFILE => "path/to/blzpc_converted.txt",
MODE_BLZ_FILE => 'MINIMAL',
);
Then you don't have to use one of the caching methods described
above. This requires the Storable-Module.