blib/lib/Params/Validate/XS.pm

filter: Statementstmt 100% 27 / 27 Branchbran 87.5% 7 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 95.3% 41 / 43 CC 5 SCAR 7.4
CC
5
Cov
97%
validation_options
3.0
_check_regex_from_xs
3.0
BEGIN
1.0
CRAP 2.1
« Build ↑ Summary blib/lib/Params/ValidatePP.pm »
1 package Params::Validate::XS;
2  
3 34 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 34 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 34 our $VERSION = '1.29';
7  
8 34 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 my $default_fail = sub {
11 10 ▶ Carp::confess( $_[0] );
Subroutine __ANON__: called CC=1 SCAR=0.0
12 34 };
13  
14 {
15 34 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 34 *set_options = \&validation_options;
25  
26 sub validation_options {
27 40 ▶ my %opts = @_;
Subroutine validation_options: called CC=3 SCAR=11.0
Pod undocumented
28  
29 40 my $caller = caller;
30  
31 40 foreach ( keys %defaults ) {
32 240 ▶ $opts{$_} = $defaults{$_} unless exists $opts{$_};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $opts{$_} 200 40 240
33 }
34  
35 40 $Params::Validate::OPTIONS{$caller} = \%opts;
36 }
37  
38 34 ▶ use XSLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 XSLoader::load(
40 __PACKAGE__,
41 exists $Params::Validate::XS::{VERSION}
42 34 ▶ ? ${ $Params::Validate::XS::{VERSION} }
Branch: 1 branch
BranchTrueFalseTotal
exists $Params::Validate::XS::{'VERSION'} ? : 34 0 34
43 : (),
44 );
45 }
46  
47 sub _check_regex_from_xs {
48 9 ▶ return ( defined $_[0] ? $_[0] : '' ) =~ /$_[1]/ ? 1 : 0;
Subroutine _check_regex_from_xs: called CC=3 SCAR=11.0
Branch: 2 branches
BranchTrueFalseTotal
(defined $_[0] ? $_[0] : '') =~ /$_[1]/ ? : 5 4 9
defined $_[0] ? : 7 2 9
49 }
50  
51 34 1;
« Build ↑ Summary blib/lib/Params/ValidatePP.pm »