File Coverage

blib/lib/Apache/Voodoo/Validate/bit.pm
Criterion Covered Total %
statement 16 16 100.0
branch 4 4 100.0
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 25 27 92.5


line stmt bran cond sub pod time code
1             package Apache::Voodoo::Validate::bit;
2              
3             $VERSION = "3.0200";
4              
5 2     2   1528 use strict;
  2         6  
  2         84  
6 2     2   11 use warnings;
  2         3  
  2         76  
7              
8 2     2   12 use base("Apache::Voodoo::Validate::Plugin");
  2         3  
  2         597  
9              
10             sub config {
11 1     1 0 2 my ($self,$conf) = @_;
12 1         6 return ();
13             }
14              
15             sub valid {
16 14     14 0 23 my ($self,$v) = @_;
17              
18 14 100       88 if ($v =~ /^(0*[1-9]\d*|y(es)?|t(rue)?)$/i) {
    100          
19 6         19 return 1;
20             }
21             elsif ($v =~ /^(0+|n(o)?|f(alse)?)$/i) {
22 6         21 return 0;
23             }
24             else {
25 2         9 return undef,'BAD';
26             }
27             }
28              
29             1;
30              
31             ################################################################################
32             # Copyright (c) 2005-2010 Steven Edwards (maverick@smurfbane.org).
33             # All rights reserved.
34             #
35             # You may use and distribute Apache::Voodoo under the terms described in the
36             # LICENSE file include in this package. The summary is it's a legalese version
37             # of the Artistic License :)
38             #
39             ################################################################################