Business::CUSIP - Verify Committee on Uniform Security Identification Procedures Numbers
use Business::CUSIP; $csp = Business::CUSIP->new('035231AH2'); print "Looks good.\n" if $csp->is_valid; $csp = Business::CUSIP->new('392690QT', 1); $chk = $csp->check_digit; $csp->cusip($csp->cusip.$chk); print $csp->is_valid ? "Looks good." : "Invalid: ", $Business::CUSIP::ERROR, "\n";
This module verifies CUSIPs, which are financial identifiers issued by the Standard & Poor's Company for US and Canadian securities. This module cannot tell if a CUSIP references a real security, but it can tell you if the given CUSIP is properly formatted.
The new constructor takes two optional arguments: the CUSIP number and a Boolean value signifying whether this CUSIP refers to a fixed income security. CUSIPs for fixed income securities are validated a little differently than other CUSIPs.
If no argument is given to this method, it will return the current CUSIP number. If an argument is provided, it will set the CUSIP number and then return the CUSIP number.
If no argument is given to this method, it will return whether the CUSIP object is marked as a fixed income security. If an argument is provided, it will set the fixed income property and then return the fixed income setting.
Returns the issuer number from the CUSIP number.
Returns the issue number from the CUSIP number.
Returns true if the checksum of the CUSIP is correct otherwise it returns false and $Business::CUSIP::ERROR will contain a description of the problem.
If the CUSIP object is not valid (! is_valid()) it returns the reason it is not valid. Otherwise returns undef.
This method returns the checksum of the given object. If the CUSIP number of the object contains a check_digit, it is ignored. In other words this method recalculates the check_digit each time.
This module uses the Algorithm::LUHN module and it adds characters to the valid_chars map of Algorithm::LUHN. So if you rely on the default valid map in the same program you use Business::CUSIP you might be surprised.
valid_chars
This module was written by Tim Ayers (http://search.cpan.org/search?author=TAYERS).
Copyright (c) 2001 Tim Ayers. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
General CUSIP information may be found at http://www.cusip.com.
To install Business::CUSIP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Business::CUSIP
CPAN shell
perl -MCPAN -e shell install Business::CUSIP
For more information on module installation, please visit the detailed CPAN module installation guide.