line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Attribute::Contract::Utils; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
19
|
use strict; |
|
4
|
|
|
|
|
32
|
|
|
4
|
|
|
|
|
125
|
|
4
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
99
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
20
|
use base 'Exporter'; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
1541
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT = qw(build_check); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub build_check { |
11
|
8
|
|
|
8
|
0
|
18
|
my ($package, $name, $code_ref, $import, $attributes) = @_; |
12
|
|
|
|
|
|
|
|
13
|
8
|
50
|
|
|
|
23
|
$attributes = '' unless defined $attributes; |
14
|
|
|
|
|
|
|
|
15
|
8
|
|
|
|
|
13
|
my $prefix = ''; |
16
|
8
|
|
|
|
|
15
|
$prefix .= 'use Type::Params compile => {confess => 1};'; |
17
|
8
|
|
|
|
|
22
|
foreach my $key (keys %$import) { |
18
|
15
|
100
|
|
|
|
59
|
if ($key eq '-types') { |
|
|
50
|
|
|
|
|
|
19
|
7
|
|
|
|
|
24
|
my @types = |
20
|
7
|
50
|
|
|
|
28
|
ref $import->{$key} ? @{$import->{$key}} : ($import->{$key}); |
21
|
7
|
|
|
|
|
41
|
$prefix .= "use Types::Standard qw(@types);"; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
elsif ($key eq '-library') { |
24
|
0
|
|
|
|
|
0
|
my $lib = $import->{$key}; |
25
|
0
|
0
|
|
|
|
0
|
foreach my $library (ref $lib ? @$lib : $lib) { |
26
|
0
|
|
|
|
|
0
|
$prefix .= "use $library -types;"; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
4
|
50
|
|
4
|
|
3881
|
my $ref = eval "$prefix; Type::Params::compile($attributes)" |
|
4
|
|
|
4
|
|
382809
|
|
|
4
|
|
|
4
|
|
40
|
|
|
4
|
|
|
3
|
|
987
|
|
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
19
|
|
|
4
|
|
|
|
|
25
|
|
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
30
|
|
|
3
|
|
|
|
|
815
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
684
|
|
32
|
|
|
|
|
|
|
or die "Can't compile types: $@"; |
33
|
8
|
|
|
|
|
20513
|
return $ref; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |