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
|
|
166052
|
use 5.14.0; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
174
|
|
5
|
4
|
|
|
4
|
|
18
|
use strict; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
148
|
|
6
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
958
|
|
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.05'; # 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
|
|
37
|
my (@ARGUMENTS, @LIBRARIES); |
23
|
|
|
|
|
|
|
|
24
|
4
|
50
|
|
|
|
35
|
for (map 'ARRAY' eq ref $_ ? @$_ : $_, splice @_, 1) { |
25
|
4
|
100
|
50
|
|
|
40
|
push @LIBRARIES => $_ and next if !ref && !/^:/; |
|
|
|
33
|
|
|
|
|
26
|
2
|
|
|
|
|
6
|
push @ARGUMENTS => $_; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
4
|
|
|
|
|
26
|
Type::Registry->for_class($CALLER)->add_types($_) for @DEFAULTS, @LIBRARIES; |
30
|
4
|
|
|
|
|
199791
|
Function::Parameters->import(@ARGUMENTS); |
31
|
|
|
|
|
|
|
|
32
|
4
|
|
|
|
|
1597
|
return; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |