line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Types::Sub; |
2
|
2
|
|
|
2
|
|
179027
|
use 5.010; |
|
2
|
|
|
|
|
11
|
|
3
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
30
|
|
4
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
60
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.15"; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
388
|
use Sub::Meta; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
42
|
|
9
|
2
|
|
|
2
|
|
335
|
use Sub::Meta::Type; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
58
|
|
10
|
2
|
|
|
2
|
|
370
|
use Sub::Meta::TypeSub; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
40
|
|
11
|
2
|
|
|
2
|
|
325
|
use Sub::Meta::CreatorFunction; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
71
|
|
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
12
|
use Types::Standard qw(Ref); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
10
|
|
14
|
|
|
|
|
|
|
use Type::Library |
15
|
2
|
|
|
|
|
14
|
-base, |
16
|
|
|
|
|
|
|
-declare => qw( |
17
|
|
|
|
|
|
|
Sub |
18
|
|
|
|
|
|
|
StrictSub |
19
|
|
|
|
|
|
|
SubMeta |
20
|
|
|
|
|
|
|
StrictSubMeta |
21
|
2
|
|
|
2
|
|
859
|
); |
|
2
|
|
|
|
|
3
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
__PACKAGE__->meta->add_type( |
24
|
|
|
|
|
|
|
name => 'Sub', |
25
|
|
|
|
|
|
|
constraint_generator => _gen_sub_constraint_generator(strict => 0), |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
__PACKAGE__->meta->add_type( |
29
|
|
|
|
|
|
|
name => 'StrictSub', |
30
|
|
|
|
|
|
|
constraint_generator => _gen_sub_constraint_generator(strict => 1), |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__PACKAGE__->meta->add_type( |
34
|
|
|
|
|
|
|
name => 'SubMeta', |
35
|
|
|
|
|
|
|
constraint_generator => _gen_submeta_constraint_generator(strict => 0), |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__PACKAGE__->meta->add_type( |
39
|
|
|
|
|
|
|
name => 'StrictSubMeta', |
40
|
|
|
|
|
|
|
constraint_generator => _gen_submeta_constraint_generator(strict => 1), |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _gen_sub_constraint_generator { |
44
|
4
|
|
|
4
|
|
46
|
my (%options) = @_; |
45
|
4
|
|
|
|
|
8
|
my $strict = $options{strict}; |
46
|
|
|
|
|
|
|
|
47
|
4
|
|
|
|
|
13
|
my $CodeRef = Ref['CODE']; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
return sub { |
50
|
5
|
100
|
|
5
|
|
14749
|
return $CodeRef unless @_; |
51
|
|
|
|
|
|
|
|
52
|
3
|
100
|
|
|
|
20
|
my $SubMeta = $strict ? StrictSubMeta[@_] : SubMeta[@_]; |
53
|
|
|
|
|
|
|
|
54
|
3
|
|
|
|
|
1711
|
return Sub::Meta::TypeSub->new( |
55
|
|
|
|
|
|
|
parent => $CodeRef, |
56
|
|
|
|
|
|
|
submeta_type => $SubMeta |
57
|
|
|
|
|
|
|
) |
58
|
|
|
|
|
|
|
} |
59
|
4
|
|
|
|
|
420
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub _gen_submeta_constraint_generator { |
62
|
4
|
|
|
4
|
|
48
|
my (%options) = @_; |
63
|
4
|
|
|
|
|
7
|
my $strict = $options{strict}; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
return sub { |
66
|
8
|
|
|
8
|
|
7716
|
my $submeta = Sub::Meta->new(@_); |
67
|
|
|
|
|
|
|
|
68
|
4
|
|
|
|
|
27
|
return Sub::Meta::Type->new( |
69
|
|
|
|
|
|
|
submeta => $submeta, |
70
|
|
|
|
|
|
|
submeta_strict_check => $strict, |
71
|
|
|
|
|
|
|
find_submeta => \&Sub::Meta::CreatorFunction::find_submeta, |
72
|
|
|
|
|
|
|
); |
73
|
|
|
|
|
|
|
} |
74
|
4
|
|
|
|
|
22
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
__END__ |