line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
163138
|
use 5.008006; |
|
1
|
|
|
|
|
4
|
|
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
3
|
1
|
|
|
1
|
|
17
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
786
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Lexical::TypeTiny; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
8
|
use Types::Standard qw(Any); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
11
|
1
|
|
|
1
|
|
798
|
use Lexical::Types qw(); |
|
1
|
|
|
|
|
675
|
|
|
1
|
|
|
|
|
21
|
|
12
|
1
|
|
|
1
|
|
386
|
use Type::Registry qw(); |
|
1
|
|
|
|
|
5900
|
|
|
1
|
|
|
|
|
27
|
|
13
|
1
|
|
|
1
|
|
447
|
use Import::Into qw(); |
|
1
|
|
|
|
|
2242
|
|
|
1
|
|
|
|
|
23
|
|
14
|
1
|
|
|
1
|
|
439
|
use Variable::Magic qw(wizard cast); |
|
1
|
|
|
|
|
994
|
|
|
1
|
|
|
|
|
65
|
|
15
|
1
|
|
|
1
|
|
6
|
use Carp qw(); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
312
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub import { |
18
|
1
|
|
|
1
|
|
9
|
my $me = shift; |
19
|
1
|
|
|
|
|
2
|
my $caller = caller; |
20
|
1
|
|
|
|
|
3
|
$me->setup_for($caller, @_); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub setup_for { |
24
|
1
|
|
|
1
|
0
|
1
|
my $me = shift; |
25
|
1
|
|
|
|
|
3
|
my ($caller, @args) = @_; |
26
|
1
|
|
|
|
|
1
|
my %args = map { $_ => 1 } @args; |
|
0
|
|
|
|
|
0
|
|
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
8
|
my $reg = Type::Registry->for_class($caller); |
29
|
1
|
|
50
|
|
|
39
|
/\W/ or eval "package $_" for keys %$reg; |
30
|
|
|
|
|
|
|
|
31
|
1
|
50
|
|
|
|
4
|
if ($args{-nocheck}) { |
32
|
0
|
|
|
0
|
|
0
|
Lexical::Types->import::into($caller, as => sub { Any }); |
|
0
|
|
|
|
|
0
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
else { |
35
|
1
|
|
|
1
|
|
7
|
Lexical::Types->import::into($caller, as => sub { $reg->lookup($_[0]) }); |
|
1
|
|
|
|
|
219
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub Type::Tiny::TYPEDSCALAR { |
40
|
1
|
|
|
1
|
0
|
75
|
my $type = $_[0]; |
41
|
|
|
|
|
|
|
|
42
|
1
|
50
|
|
|
|
7
|
return if $type == Any; |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
149
|
my $var = \$_[1]; |
45
|
1
|
|
|
|
|
3
|
my $check = $type->compiled_check; |
46
|
|
|
|
|
|
|
my $wiz = wizard( |
47
|
|
|
|
|
|
|
set => sub { |
48
|
|
|
|
|
|
|
package # hide from PAUSE |
49
|
|
|
|
|
|
|
Type::Tiny; |
50
|
3
|
100
|
|
3
|
|
104
|
$check->(${$_[0]}) or Carp::croak($type->get_message(${$_[0]})); |
|
1
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
9
|
|
51
|
|
|
|
|
|
|
}, |
52
|
1
|
|
|
|
|
18
|
); |
53
|
1
|
|
|
|
|
45
|
cast $_[1], $wiz; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |