File Coverage

blib/lib/CGI/Untaint/creditcard.pm
Criterion Covered Total %
statement 11 11 100.0
branch 2 2 100.0
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 17 17 100.0


line stmt bran cond sub pod time code
1             package CGI::Untaint::creditcard;
2              
3             $VERSION = '1.00';
4              
5 1     1   9537 use strict;
  1         3  
  1         52  
6 1     1   6 use base 'CGI::Untaint::printable';
  1         3  
  1         1041  
7             require Business::CreditCard::Object;
8              
9             sub is_valid {
10 4     4 1 5120 my $self = shift;
11 4         10 my $card = Business::CreditCard::Object->new($self->value);
12 4 100       53 return unless $card->is_valid;
13 3         229 $self->value($card);
14 3         20 return $card->number;
15             }
16              
17             =head1 NAME
18              
19             CGI::Untaint::creditcard - validate a creditcard
20              
21             =head1 SYNOPSIS
22              
23             use CGI::Untaint;
24             my $handler = CGI::Untaint->new($q->Vars);
25              
26             my $cc = $handler->extract(-as_creditcard => 'ccno');
27              
28             print $cc->number;
29              
30             =head1 DESCRIPTION
31              
32             =head2 is_valid
33              
34             This Input Handler verifies that it is dealing with a reasonable credit
35             card number (i.e. one that L believes to
36             be valid.)
37              
38             The resulting object will be set back into value().
39              
40             =head1 SEE ALSO
41              
42             L. L.
43              
44             =head1 BUGS and QUERIES
45              
46             Please direct all correspondence regarding this module to:
47             bug-CGI-Untaint-creditcard@rt.cpan.org
48              
49             =head1 COPYRIGHT
50              
51             Copyright (C) 2001-2005 Tony Bowden.
52              
53             This program is free software; you can redistribute it and/or modify it under
54             the terms of the GNU General Public License; either version 2 of the License,
55             or (at your option) any later version.
56              
57             This program is distributed in the hope that it will be useful, but WITHOUT
58             ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
59             FOR A PARTICULAR PURPOSE.
60              
61             =cut
62              
63             1;