Tim Ayers > Business-CUSIP > Business::CUSIP

Download:
Business-CUSIP-1.03.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 1.03   Source  

NAME ^

Business::CUSIP - Verify Committee on Uniform Security Identification Procedures Numbers

SYNOPSIS ^

  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";

DESCRIPTION ^

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.

METHODS ^

new([CUSIP_NUMBER[, IS_FIXED_INCOME]])

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.

cusip([CUSIP_NUMBER])

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.

is_fixed_income([TRUE_OR_FALSE])

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.

issuer_num()

Returns the issuer number from the CUSIP number.

issue_num()

Returns the issue number from the CUSIP number.

is_valid()

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.

error()

If the CUSIP object is not valid (! is_valid()) it returns the reason it is not valid. Otherwise returns undef.

check_digit()

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.

CAVEATS ^

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.

AUTHOR ^

This module was written by Tim Ayers (http://search.cpan.org/search?author=TAYERS).

COPYRIGHT ^

Copyright (c) 2001 Tim Ayers. All rights reserved.

LICENSE ^

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO ^

General CUSIP information may be found at http://www.cusip.com.

syntax highlighting: