CGI::Untaint::creditcard - validate a creditcard


CGI-Untaint-creditcard documentation Contained in the CGI-Untaint-creditcard distribution.

Index


Code Index:

NAME

Top

CGI::Untaint::creditcard - validate a creditcard

SYNOPSIS

Top

  use CGI::Untaint;
  my $handler = CGI::Untaint->new($q->Vars);

  my $cc = $handler->extract(-as_creditcard => 'ccno');

	print $cc->number;

DESCRIPTION

Top

is_valid

This Input Handler verifies that it is dealing with a reasonable credit card number (i.e. one that Business::CreditCard::Object believes to be valid.)

The resulting object will be set back into value().

SEE ALSO

Top

CGI::Untaint. Business::CreditCard::Object.

BUGS and QUERIES

Top

Please direct all correspondence regarding this module to: bug-CGI-Untaint-creditcard@rt.cpan.org

COPYRIGHT

Top


CGI-Untaint-creditcard documentation Contained in the CGI-Untaint-creditcard distribution.

package CGI::Untaint::creditcard;

$VERSION = '1.00';

use strict;
use base 'CGI::Untaint::printable';
require Business::CreditCard::Object;

sub is_valid { 
  my $self = shift;
	my $card = Business::CreditCard::Object->new($self->value);
  return unless $card->is_valid;
  $self->value($card);
  return $card->number;
}

1;