CleanCode Perl Libraries
Multi-Lingual Library Maintainability
available: Perl not available: Java available: JavaScript not available: Certified
Class
not available: Testable
Class
not available: Standalone
Mode
not available: Diagnostic
Enabled


NAME

CGI::PageValidator::Plugin::CreditCardNum - verifies a credit card number is valid for a given credit card type and has a valid checksum.


SYNOPSIS

(See the Note on Plugins in the CheckItem class for usage notes.)

        use CGI::PageValidator::Plugin::CreditCardNum;
        $pluginObj=CGI::PageValidator::Plugin::CreditCardNum->new($libItem,
                "CCType", "4285123412341234", "visa", "CGI::PageValidator::PluginLib");
        $pluginObj->examine();
        $errMsg = $pluginObj->getResult();

EXTENDS

CGI::PageValidator::Plugin


REQUIRES

Perl5.005, CGI::PageValidator::Plugin


KNOWN PLUGIN ATTACHMENTS

CCNumber

Dependent fields: CCType


DESCRIPTION

This plugin examines a credit card number and type and performs two tests:

This plugin uses a small custom library CCLib that provides a pattern for each credit card type to match against. (This library, like the main validation library, is auto-generated from the JavaScript version in order to maintain only a single copy.)

This code is loosely based on a sample credit card validation from Netscape (originally at developer.netscape.com/docs/examples/javascript/regexp/overview.html but this link is no longer available).


BUGS

None


AUTHOR

Michael Sorens


VERSION

$Revision: 8 $ $Date: 2006-12-19 21:13:43 -0800 (Tue, 19 Dec 2006) $


SINCE

CleanCode 0.9


CleanCode Perl Libraries Copyright © 2001-2008 Michael Sorens - Revised 2008.07.31