File Coverage

lib/Data/Validation/Constants.pm
Criterion Covered Total %
statement 17 17 100.0
branch 4 4 100.0
condition n/a
subroutine 6 6 100.0
pod 2 2 100.0
total 29 29 100.0


line stmt bran cond sub pod time code
1             package Data::Validation::Constants;
2              
3 1     1   4 use strict;
  1         1  
  1         24  
4 1     1   3 use warnings;
  1         1  
  1         30  
5 1     1   3 use parent 'Exporter::Tiny';
  1         1  
  1         6  
6              
7 1     1   387 use Data::Validation::Exception;
  1         2  
  1         171  
8              
9             our @EXPORT = qw( EXCEPTION_CLASS FALSE HASH NUL SPC TRUE );
10              
11             my $Exception_Class = 'Data::Validation::Exception';
12              
13 53     53 1 253 sub EXCEPTION_CLASS () { __PACKAGE__->Exception_Class }
14             sub FALSE () { 0 }
15             sub HASH () { 'HASH' }
16             sub NUL () { q() }
17             sub SPC () { q( ) }
18             sub TRUE () { 1 }
19              
20             sub Exception_Class {
21 55 100   55 1 1773 my ($self, $class) = @_; defined $class or return $Exception_Class;
  55         372  
22              
23 2 100       24 $class->can( 'throw' )
24             or die "Class '${class}' is not loaded or has no 'throw' method";
25              
26 1         5 return $Exception_Class = $class;
27             }
28              
29             1;
30              
31             __END__