File Coverage

blib/lib/CGI/Untaint/ipaddress.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 14 100.0


line stmt bran cond sub pod time code
1             package CGI::Untaint::ipaddress;
2              
3 1     1   7899 use strict;
  1         2  
  1         37  
4 1     1   5 use base 'CGI::Untaint::object';
  1         1  
  1         922  
5              
6 1     1   322 use vars qw/$VERSION/;
  1         2  
  1         173  
7             $VERSION = '0.01';
8              
9             sub _untaint_re {
10 18     18   2659 return qr/^((?:(?:25[0-5]|2[0-4]\d|[0-1]??\d{1,2})[.](?:25[0-5]|2[0-4]\d|[0-1]??\d{1,2})[.](?:25[0-5]|2[0-4]\d|[0-1]??\d{1,2})[.](?:25[0-5]|2[0-4]\d|[0-1]??\d{1,2})))$/i;
11             }
12              
13             =head1 NAME
14              
15             CGI::Untaint::ipaddress - validate an IP address
16              
17             =head1 SYNOPSIS
18              
19             use CGI::Untaint;
20             my $handler = CGI::Untaint->new($q->Vars);
21              
22             my $url = $handler->extract( -as_ipaddress => 'ip' );
23              
24             =head1 DESCRIPTION
25              
26             This CGI::Untaint input handler verifies that it is dealing with a
27             reasonable IP. It does not check that the IP address is routable or reserved.
28              
29             =head1 SEE ALSO
30              
31             L
32              
33             =head1 AUTHOR
34              
35             Simon Cozens, C
36              
37             =head1 COPYRIGHT
38              
39             Copyright (C) 2003 Simon Cozens. All rights reserved.
40              
41             This module is free software; you can redistribute it and/or modify
42             it under the same terms as Perl itself.
43              
44             =cut
45              
46             1;