line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Accessor::Typed::TypeTiny; |
2
|
1
|
|
|
1
|
|
1246
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
4
|
1
|
|
|
1
|
|
5
|
use utf8; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
20
|
use Scalar::Util qw/blessed/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
7
|
1
|
|
|
1
|
|
1689
|
use Type::Registry; |
|
1
|
|
|
|
|
12815
|
|
|
1
|
|
|
|
|
14
|
|
8
|
1
|
|
|
1
|
|
514
|
use Type::Utils; |
|
1
|
|
|
|
|
22257
|
|
|
1
|
|
|
|
|
7
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my $reg = Type::Registry->for_class(__PACKAGE__); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub type { |
13
|
0
|
|
|
0
|
0
|
|
my ($class, $type_name) = @_; |
14
|
0
|
0
|
|
|
|
|
return $type_name if blessed($type_name); |
15
|
|
|
|
|
|
|
|
16
|
0
|
0
|
|
|
|
|
if (my $type = $reg->simple_lookup($type_name)) { |
17
|
0
|
|
|
|
|
|
return $type; |
18
|
|
|
|
|
|
|
} else { |
19
|
0
|
|
|
|
|
|
my $type = Type::Utils::dwim_type( |
20
|
|
|
|
|
|
|
$type_name, |
21
|
|
|
|
|
|
|
fallback => [ 'lookup_via_mouse', 'make_class_type' ], |
22
|
|
|
|
|
|
|
); |
23
|
0
|
|
|
|
|
|
$type->{display_name} = $type_name; |
24
|
0
|
|
|
|
|
|
$reg->add_type($type, $type_name); |
25
|
0
|
|
|
|
|
|
return $type; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub type_role { |
30
|
0
|
|
|
0
|
0
|
|
my ($class, $type_name) = @_; |
31
|
0
|
0
|
|
|
|
|
return $type_name if blessed($type_name); |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
if (my $type = $reg->simple_lookup($type_name)) { |
34
|
0
|
|
|
|
|
|
return $type; |
35
|
|
|
|
|
|
|
} else { |
36
|
0
|
|
|
|
|
|
my $type = Type::Utils::dwim_type( |
37
|
|
|
|
|
|
|
$type_name, |
38
|
|
|
|
|
|
|
fallback => ['make_role_type'], |
39
|
|
|
|
|
|
|
); |
40
|
0
|
|
|
|
|
|
$type->{display_name} = $type_name; |
41
|
0
|
|
|
|
|
|
$reg->add_type($type, $type_name); |
42
|
0
|
|
|
|
|
|
return $type; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |