line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
6
|
|
|
6
|
|
5201
|
use 5.008; |
|
6
|
|
|
|
|
20
|
|
|
6
|
|
|
|
|
249
|
|
2
|
6
|
|
|
6
|
|
34
|
use strict; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
226
|
|
3
|
6
|
|
|
6
|
|
30
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
430
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Type::Tiny::Wrapper; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
9
|
|
|
|
|
|
|
|
10
|
6
|
|
|
6
|
|
30
|
use base 'Type::Tiny'; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
743
|
|
11
|
6
|
|
|
6
|
|
36
|
use Scalar::Util 'weaken'; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
4138
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
12
|
|
|
12
|
1
|
839
|
my $class = shift; |
15
|
12
|
|
|
|
|
101
|
my $self = $class->SUPER::new(@_); |
16
|
12
|
50
|
|
|
|
1282
|
Type::Tiny::_croak("Type::Tiny::Wrapper types must not have a constraint!") |
17
|
|
|
|
|
|
|
unless $self->_is_null_constraint; |
18
|
12
|
|
|
|
|
227
|
return $self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub wrap { |
22
|
10
|
|
|
10
|
1
|
23
|
my $self = shift; |
23
|
10
|
|
|
|
|
40
|
my $type = Types::TypeTiny::to_TypeTiny($_[0]); |
24
|
10
|
|
|
|
|
3524
|
require Type::Tiny::Wrapped; |
25
|
10
|
|
|
|
|
2955
|
require Type::Coercion::Wrapped; |
26
|
10
|
|
|
|
|
60
|
my $wrapped = bless($type->create_child_type => 'Type::Tiny::Wrapped'); |
27
|
10
|
|
|
|
|
1417
|
$wrapped->{wrapper} = $self; |
28
|
10
|
|
|
|
|
58
|
$wrapped->{display_name} = sprintf('%s[%s]', $self->display_name, $type->display_name); |
29
|
7
|
|
|
|
|
117
|
$wrapped->{coercion} ||= 'Type::Coercion::Wrapped'->new( |
30
|
|
|
|
|
|
|
type_constraint => $wrapped, |
31
|
|
|
|
|
|
|
type_coercion_map => $type->has_coercion |
32
|
10
|
100
|
33
|
|
|
444
|
? [ @{$type->coercion->type_coercion_map} ] |
33
|
|
|
|
|
|
|
: [ Types::Standard::Any(), q{ $_ } ], |
34
|
|
|
|
|
|
|
); |
35
|
10
|
|
|
|
|
5766
|
bless($wrapped->{coercion} => 'Type::Coercion::Wrapped'); |
36
|
10
|
|
|
|
|
48
|
return $wrapped; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my @FIELDS = qw/ |
40
|
|
|
|
|
|
|
pre_check pre_coerce post_check post_coerce |
41
|
|
|
|
|
|
|
inlined_pre_check inlined_pre_coerce inlined_post_check inlined_post_coerce |
42
|
|
|
|
|
|
|
/; |
43
|
0
|
|
|
0
|
1
|
0
|
sub pre_check { $_[0]{pre_check} } |
44
|
0
|
|
|
0
|
1
|
0
|
sub pre_coerce { $_[0]{pre_coerce} } |
45
|
0
|
|
|
0
|
1
|
0
|
sub post_check { $_[0]{post_check} } |
46
|
0
|
|
|
0
|
1
|
0
|
sub post_coerce { $_[0]{post_coerce} } |
47
|
0
|
|
|
0
|
1
|
0
|
sub inlined_pre_check { $_[0]{inlined_pre_check} } |
48
|
0
|
|
|
0
|
1
|
0
|
sub inlined_pre_coerce { $_[0]{inlined_pre_coerce} } |
49
|
0
|
|
|
0
|
1
|
0
|
sub inlined_post_check { $_[0]{inlined_post_check} } |
50
|
0
|
|
|
0
|
1
|
0
|
sub inlined_post_coerce { $_[0]{inlined_post_coerce} } |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
0
|
1
|
0
|
sub child_type_class { +__PACKAGE__ } |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub create_child_type { |
55
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
56
|
0
|
0
|
|
|
|
0
|
$self->SUPER::create_child_type( |
57
|
|
|
|
|
|
|
( map { |
58
|
0
|
|
|
|
|
0
|
exists($self->{$_}) ? ($_ => $self->{$_}) : () |
59
|
|
|
|
|
|
|
} @FIELDS ), |
60
|
|
|
|
|
|
|
@_, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
22
|
|
|
22
|
1
|
117896
|
sub has_constraint_generator { 1 } |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub constraint_generator { |
67
|
10
|
|
|
10
|
1
|
6854
|
my $self = shift; |
68
|
10
|
|
|
|
|
42
|
weaken $self; |
69
|
10
|
|
|
10
|
|
62
|
return sub { $self->wrap(shift) }; |
|
10
|
|
|
|
|
56
|
|
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
__END__ |