| Business-SWIFT documentation | Contained in the Business-SWIFT distribution. |
Business::SWIFT - Validate SWIFT/BIC Bank identifiers.
Version 0.01
This module implements the SWIFT BIC format validation.
It checks if the given SWIFT BIC code is well-formed according to the ISO 9362 Specification. It does not check if the code is a valid actual bank code.
use Business::SWIFT;
if ( Business::SWIFT->validateBIC('DEUTDEFF') ){
.. do stuff ..
}
Based on the following specification: http://en.wikipedia.org/wiki/ISO_9362
Returns a true value if the given BIC code is correct. False otherwise.
Code letters have to be uppercase.
This is a class method.
Usage example:
if ( Business::SWIFT->validateBIC('DEUTDEFF') ){
.. do stuff ..
}
Jerome Eteve <jerome at eteve.net>
Please report any bugs or feature requests to
bug-business-swift at rt.cpan.org, or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Business-SWIFT.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc Business::SWIFT
You can also look for information at:
Copyright 2009 Careerjet, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Business-SWIFT documentation | Contained in the Business-SWIFT distribution. |
package Business::SWIFT; use warnings; use strict; use Locales ;
our $VERSION = '0.02';
sub validateBIC{ my ( $class , $candidate ) = @_ ; my $candLength = length($candidate) ; if( ( 8 != $candLength ) && ( 11 != $candLength ) ){ return 0; } my ( $bankCode , $countryCode , $locationCode , $branchCode ) = ( $candidate =~ /^([A-Z]{4})([A-Z]{2})([A-Z0-9]{2})([A-Z0-9]{3})?/ ); if( ! $bankCode ){ return 0; } my $en = Locales->new( "en" ); if ( ! $en->get_territory_from_code( $countryCode ) ){ return 0; } if ( ! $locationCode ){ return 0; } if ( ( $candLength == 11 ) && ( ! $branchCode ) ){ return 0; } ## All is correct return 1; }
1; # End of Business::SWIFT