line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Method/Function Signatures w/Type::Tiny Constraints |
2
|
|
|
|
|
|
|
package Type::Tiny::Signatures; |
3
|
|
|
|
|
|
|
|
4
|
4
|
|
|
4
|
|
170000
|
use 5.14.0; |
|
4
|
|
|
|
|
15
|
|
5
|
4
|
|
|
4
|
|
21
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
88
|
|
6
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
1095
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Function::Parameters; |
9
|
|
|
|
|
|
|
require Type::Registry; |
10
|
|
|
|
|
|
|
require Type::Tiny; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $CALLER = caller; |
13
|
|
|
|
|
|
|
our @DEFAULTS = 'Types::Standard'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.06'; # VERSION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
unshift @Function::Parameters::type_reifiers => sub { |
18
|
|
|
|
|
|
|
Type::Registry->for_class($CALLER)->lookup($_[0]); |
19
|
|
|
|
|
|
|
}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub import { |
22
|
4
|
|
|
4
|
|
51
|
my (@ARGUMENTS, @LIBRARIES); |
23
|
|
|
|
|
|
|
|
24
|
4
|
50
|
|
|
|
43
|
for (map 'ARRAY' eq ref $_ ? @$_ : $_, splice @_, 1) { |
25
|
4
|
100
|
50
|
|
|
47
|
push @LIBRARIES => $_ and next if !ref && !/^:/; |
|
|
|
33
|
|
|
|
|
26
|
2
|
|
|
|
|
6
|
push @ARGUMENTS => $_; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
4
|
|
|
|
|
29
|
Type::Registry->for_class($CALLER)->add_types($_) for @DEFAULTS, @LIBRARIES; |
30
|
4
|
|
|
|
|
211950
|
Function::Parameters->import(@ARGUMENTS); |
31
|
|
|
|
|
|
|
|
32
|
4
|
|
|
|
|
1620
|
return; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |