| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Specio::Role::Inlinable; |
|
2
|
|
|
|
|
|
|
|
|
3
|
28
|
|
|
28
|
|
178
|
use strict; |
|
|
28
|
|
|
|
|
49
|
|
|
|
28
|
|
|
|
|
728
|
|
|
4
|
28
|
|
|
28
|
|
120
|
use warnings; |
|
|
28
|
|
|
|
|
51
|
|
|
|
28
|
|
|
|
|
1083
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.46'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
28
|
|
|
28
|
|
3761
|
use Eval::Closure qw( eval_closure ); |
|
|
28
|
|
|
|
|
10362
|
|
|
|
28
|
|
|
|
|
1101
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
28
|
|
|
28
|
|
146
|
use Role::Tiny; |
|
|
28
|
|
|
|
|
47
|
|
|
|
28
|
|
|
|
|
154
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
requires '_build_description'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
{ |
|
15
|
|
|
|
|
|
|
my $attrs = { |
|
16
|
|
|
|
|
|
|
_inline_generator => { |
|
17
|
|
|
|
|
|
|
is => 'ro', |
|
18
|
|
|
|
|
|
|
isa => 'CodeRef', |
|
19
|
|
|
|
|
|
|
predicate => '_has_inline_generator', |
|
20
|
|
|
|
|
|
|
init_arg => 'inline_generator', |
|
21
|
|
|
|
|
|
|
}, |
|
22
|
|
|
|
|
|
|
inline_environment => { |
|
23
|
|
|
|
|
|
|
is => 'ro', |
|
24
|
|
|
|
|
|
|
isa => 'HashRef', |
|
25
|
|
|
|
|
|
|
lazy => 1, |
|
26
|
|
|
|
|
|
|
init_arg => 'inline_environment', |
|
27
|
|
|
|
|
|
|
builder => '_build_inline_environment', |
|
28
|
|
|
|
|
|
|
}, |
|
29
|
|
|
|
|
|
|
_generated_inline_sub => { |
|
30
|
|
|
|
|
|
|
is => 'ro', |
|
31
|
|
|
|
|
|
|
isa => 'CodeRef', |
|
32
|
|
|
|
|
|
|
init_arg => undef, |
|
33
|
|
|
|
|
|
|
lazy => 1, |
|
34
|
|
|
|
|
|
|
builder => '_build_generated_inline_sub', |
|
35
|
|
|
|
|
|
|
}, |
|
36
|
|
|
|
|
|
|
declared_at => { |
|
37
|
|
|
|
|
|
|
is => 'ro', |
|
38
|
|
|
|
|
|
|
isa => 'Specio::DeclaredAt', |
|
39
|
|
|
|
|
|
|
required => 1, |
|
40
|
|
|
|
|
|
|
}, |
|
41
|
|
|
|
|
|
|
description => { |
|
42
|
|
|
|
|
|
|
is => 'ro', |
|
43
|
|
|
|
|
|
|
isa => 'Str', |
|
44
|
|
|
|
|
|
|
init_arg => undef, |
|
45
|
|
|
|
|
|
|
lazy => 1, |
|
46
|
|
|
|
|
|
|
builder => '_build_description', |
|
47
|
|
|
|
|
|
|
}, |
|
48
|
|
|
|
|
|
|
}; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) |
|
51
|
|
|
|
|
|
|
sub _attrs { |
|
52
|
56
|
|
|
56
|
|
116
|
return $attrs; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# These are here for backwards compatibility. Some other packages that I wrote |
|
57
|
|
|
|
|
|
|
# may call the private methods. |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) |
|
60
|
0
|
|
|
0
|
|
0
|
sub _description { $_[0]->description } |
|
61
|
0
|
|
|
0
|
|
0
|
sub _inline_environment { $_[0]->inline_environment } |
|
62
|
|
|
|
|
|
|
## use critic |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub can_be_inlined { |
|
65
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
0
|
return $self->_has_inline_generator; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub _build_generated_inline_sub { |
|
71
|
1
|
|
|
1
|
|
7
|
my $self = shift; |
|
72
|
|
|
|
|
|
|
|
|
73
|
1
|
|
|
|
|
5
|
my $source |
|
74
|
|
|
|
|
|
|
= 'sub { ' . $self->_inline_generator->( $self, '$_[0]' ) . '}'; |
|
75
|
|
|
|
|
|
|
|
|
76
|
1
|
|
|
|
|
11
|
return eval_closure( |
|
77
|
|
|
|
|
|
|
source => $source, |
|
78
|
|
|
|
|
|
|
environment => $self->inline_environment, |
|
79
|
|
|
|
|
|
|
description => 'inlined sub for ' . $self->description, |
|
80
|
|
|
|
|
|
|
); |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub _build_inline_environment { |
|
84
|
411
|
|
|
411
|
|
2695
|
return {}; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# ABSTRACT: A role for things which can be inlined (type constraints and coercions) |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__END__ |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=pod |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=encoding UTF-8 |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 NAME |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Specio::Role::Inlinable - A role for things which can be inlined (type constraints and coercions) |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 VERSION |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
version 0.46 |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This role implements a common API for inlinable things, type constraints and |
|
108
|
|
|
|
|
|
|
coercions. It is fully documented in the relevant classes. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=for Pod::Coverage .* |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 SUPPORT |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/Specio/issues>. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 SOURCE |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
The source code repository for Specio can be found at L<https://github.com/houseabsolute/Specio>. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 AUTHOR |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
This software is Copyright (c) 2012 - 2020 by Dave Rolsky. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This is free software, licensed under: |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
The full text of the license can be found in the |
|
135
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |