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


Manual Reference Pages  -  BUSINESS::ISIN (3)

.ds Aq ’

NAME

Business::ISIN - validate International Securities Identification Numbers

CONTENTS

VERSION

0.20

SYNOPSIS



    use Business::ISIN;

    my $isin = new Business::ISIN US459056DG91;

    if ( $isin->is_valid ) {
        print "$isin is valid!\n";
        # or: print $isin->get() . " is valid!\n";
    } else {
        print "Invalid ISIN: " . $isin->error() . "\n";
        print "The check digit I was expecting is ";
        print Business::ISIN::check_digit(US459056DG9) . "\n";
    }



REQUIRES

Perl5, Locale::Country, Carp

DESCRIPTION

Business::ISIN is a class which validates ISINs (International Securities Identification Numbers), the codes which identify shares in much the same way as ISBNs identify books. An ISIN consists of two letters, identifying the country of origin of the security according to ISO 3166, followed by nine characters in [A-Z0-9], followed by a decimal check digit.

The new() method constructs a new ISIN object. If you give it a scalar argument, it will use the argument to initialize the object’s value. Here, no attempt will be made to check that the argument is valid.

The set() method sets the ISIN’s value to a scalar argument which you give. Here, no attempt will be made to check that the argument is valid. The method returns the object, to allow you to do things like $isin->set("GB0004005475")->is_valid.

The get() method returns a string, which will be the ISIN’s value if it is syntactically valid, and undef otherwise. Interpolating the object reference in double quotes has the same effect (see the synopsis).

The is_valid() method returns true if the object contains a syntactically valid ISIN. (Note: this does <B>notB> guarantee that a security actually exists which has that ISIN.) It will return false otherwise.

If an object does contain an invalid ISIN, then the error() method will return a string explaining what is wrong, like any of the following:
o ’xxx’ does not start with a 2-letter country code
o ’xxx’ does not have characters 3-11 in [A-Za-z0-9]
o ’xxx’ character 12 should be a digit
o ’xxx’ has too many characters
o ’xxx’ has an inconsistent check digit
Otherwise, error() will return undef.

check_digit() is an ordinary subroutine and <B>notB> a class method. It takes a string of the first eleven characters of an ISIN as an argument (e.g. US459056DG9), and returns the corresponding check digit, calculated using the so-called ’double-add-double’ algorithm.

DIAGNOSTICS

check_digit() will croak with the message ’Invalid data’ if you pass it an unsuitable argument.

ACKNOWLEDGEMENTS

Thanks to Peter Dintelmann (Peter.Dintelmann@Dresdner-Bank.com) and Tim Ayers (tim.ayers@reuters.com) for suggestions and help debugging this module.

AUTHOR

David Chan <david@sheetmusic.org.uk>

COPYRIGHT

Copyright (C) 2002, David Chan. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 ISIN (3) 2002-02-13

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