line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Validation::Utils; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
26
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
5
|
1
|
|
|
1
|
|
3
|
use parent 'Exporter::Tiny'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
50
|
use Data::Validation::Constants qw( EXCEPTION_CLASS TRUE ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
8
|
1
|
|
|
1
|
|
150
|
use Module::Runtime qw( require_module ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
9
|
1
|
|
|
1
|
|
33
|
use Try::Tiny; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
54
|
|
10
|
1
|
|
|
1
|
|
3
|
use Unexpected::Functions qw( is_class_loaded ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT_OK = qw( ensure_class_loaded load_class throw ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub ensure_class_loaded ($) { |
15
|
38
|
|
|
38
|
1
|
45
|
my $class = shift; |
16
|
|
|
|
|
|
|
|
17
|
38
|
|
|
38
|
|
183
|
try { require_module( $class ) } catch { throw( $_ ) }; |
|
38
|
|
|
|
|
935
|
|
|
1
|
|
|
|
|
449
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# uncoverable branch true |
20
|
37
|
50
|
|
|
|
3848
|
is_class_loaded( $class ) |
21
|
|
|
|
|
|
|
or throw( 'Class [_1] loaded but package undefined', [ $class ] ); |
22
|
|
|
|
|
|
|
|
23
|
37
|
|
|
|
|
785
|
return TRUE; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub load_class ($$$) { |
27
|
33
|
|
|
33
|
1
|
42
|
my ($proto, $prefix, $class) = @_; $class =~ s{ \A $prefix }{}mx; |
|
33
|
|
|
|
|
175
|
|
28
|
|
|
|
|
|
|
|
29
|
33
|
100
|
|
|
|
89
|
if ('+' eq substr $class, 0, 1) { $class = substr $class, 1 } |
|
3
|
|
|
|
|
5
|
|
30
|
30
|
|
|
|
|
67
|
else { $class = "${proto}::".(ucfirst $class) } |
31
|
|
|
|
|
|
|
|
32
|
33
|
|
|
|
|
52
|
ensure_class_loaded $class; |
33
|
|
|
|
|
|
|
|
34
|
32
|
|
|
|
|
680
|
return $class; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub throw (;@) { |
38
|
46
|
|
|
46
|
1
|
215
|
EXCEPTION_CLASS->throw( @_ ); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |