File Coverage

blib/lib/Input/Validator/ConstraintBuilder.pm
Criterion Covered Total %
statement 17 17 100.0
branch 4 4 100.0
condition 2 2 100.0
subroutine 5 5 100.0
pod 1 1 100.0
total 29 29 100.0


line stmt bran cond sub pod time code
1             package Input::Validator::ConstraintBuilder;
2              
3 10     10   24337 use strict;
  10         19  
  10         324  
4 10     10   48 use warnings;
  10         21  
  10         375  
5              
6 10     10   12155 use String::CamelCase ();
  10         5267  
  10         408  
7 10     10   10125 use Class::Load ();
  10         377356  
  10         1380  
8              
9             sub build {
10 36     36 1 737 my $self = shift;
11 36         55 my $name = shift;
12              
13 36 100       198 my $class =
14             $name =~ m/[A-Z]/
15             ? $name
16             : "Input::Validator::Constraint::"
17             . String::CamelCase::camelize($name);
18              
19 36         632 Class::Load::load_class($class);
20              
21 36 100 100     2185 return $class->new(args => @_ > 1 ? [@_] : ($_[0] || []));
22             }
23              
24             1;
25             __END__