File Coverage

blib/lib/Params/Validate/XS.pm
Criterion Covered Total %
statement 18 18 100.0
branch 6 6 100.0
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 30 31 96.7


line stmt bran cond sub pod time code
1             package Params::Validate::XS;
2              
3 34     34   18281 use strict;
  34         78  
  34         1053  
4 34     34   180 use warnings;
  34         70  
  34         1398  
5              
6             our $VERSION = '1.30';
7              
8 34     34   194 use Carp;
  34         64  
  34         7606  
9              
10             my $default_fail = sub {
11             Carp::confess( $_[0] );
12             };
13              
14             {
15             my %defaults = (
16             ignore_case => 0,
17             strip_leading => 0,
18             allow_extra => 0,
19             on_fail => $default_fail,
20             stack_skip => 1,
21             normalize_keys => undef,
22             );
23              
24             *set_options = \&validation_options;
25              
26             sub validation_options {
27 40     40 0 202864 my %opts = @_;
28              
29 40         104 my $caller = caller;
30              
31 40         139 foreach ( keys %defaults ) {
32 240 100       554 $opts{$_} = $defaults{$_} unless exists $opts{$_};
33             }
34              
35 40         151 $Params::Validate::OPTIONS{$caller} = \%opts;
36             }
37              
38 34     34   288 use XSLoader;
  34         75  
  34         4318  
39             XSLoader::load(
40             __PACKAGE__,
41             exists $Params::Validate::XS::{VERSION}
42             ? ${ $Params::Validate::XS::{VERSION} }
43             : (),
44             );
45             }
46              
47             sub _check_regex_from_xs {
48 9 100   9   5882 return ( defined $_[0] ? $_[0] : '' ) =~ /$_[1]/ ? 1 : 0;
    100          
49             }
50              
51             1;