| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
|
3
|
30
|
|
|
30
|
|
172
|
use warnings; |
|
|
30
|
|
|
|
|
50
|
|
|
|
30
|
|
|
|
|
778
|
|
|
4
|
30
|
|
|
30
|
|
129
|
|
|
|
30
|
|
|
|
|
54
|
|
|
|
30
|
|
|
|
|
990
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.48'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Role::Tiny::With; |
|
8
|
30
|
|
|
30
|
|
140
|
use Specio::OO; |
|
|
30
|
|
|
|
|
48
|
|
|
|
30
|
|
|
|
|
1025
|
|
|
9
|
30
|
|
|
30
|
|
6053
|
use Storable qw( dclone ); |
|
|
30
|
|
|
|
|
60
|
|
|
|
30
|
|
|
|
|
1382
|
|
|
10
|
30
|
|
|
30
|
|
158
|
|
|
|
30
|
|
|
|
|
50
|
|
|
|
30
|
|
|
|
|
1051
|
|
|
11
|
|
|
|
|
|
|
use Specio::Constraint::Role::Interface; |
|
12
|
30
|
|
|
30
|
|
7447
|
with 'Specio::Constraint::Role::Interface'; |
|
|
30
|
|
|
|
|
58
|
|
|
|
30
|
|
|
|
|
6928
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
{ |
|
15
|
|
|
|
|
|
|
## no critic (Subroutines::ProtectPrivateSubs) |
|
16
|
|
|
|
|
|
|
my $attrs = dclone( Specio::Constraint::Role::Interface::_attrs() ); |
|
17
|
|
|
|
|
|
|
## use critic |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$attrs->{parent}{isa} = 'Specio::Constraint::Parameterizable'; |
|
20
|
|
|
|
|
|
|
$attrs->{parent}{required} = 1; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
delete $attrs->{name}{predicate}; |
|
23
|
|
|
|
|
|
|
$attrs->{name}{lazy} = 1; |
|
24
|
|
|
|
|
|
|
$attrs->{name}{builder} = '_build_name'; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$attrs->{parameter} = { |
|
27
|
|
|
|
|
|
|
does => 'Specio::Constraint::Role::Interface', |
|
28
|
|
|
|
|
|
|
required => 1, |
|
29
|
|
|
|
|
|
|
}; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) |
|
32
|
|
|
|
|
|
|
return $attrs; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
60
|
|
|
60
|
|
120
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $self = shift; |
|
37
|
|
|
|
|
|
|
return defined $self->name; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
23
|
|
|
23
|
|
36
|
|
|
40
|
23
|
|
|
|
|
67
|
my $self = shift; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
## no critic (Subroutines::ProtectPrivateSubs) |
|
43
|
|
|
|
|
|
|
return unless $self->parent->_has_name && $self->parameter->_has_name; |
|
44
|
14
|
|
|
14
|
|
77
|
return $self->parent->name . '[' . $self->parameter->name . ']'; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
14
|
50
|
33
|
|
|
47
|
my $self = shift; |
|
48
|
14
|
|
|
|
|
253
|
|
|
49
|
|
|
|
|
|
|
return $self->_has_inline_generator |
|
50
|
|
|
|
|
|
|
&& $self->parameter->can_be_inlined; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
33
|
|
|
33
|
0
|
68
|
|
|
53
|
|
|
|
|
|
|
# Moose compatibility methods - these exist as a temporary hack to make Specio |
|
54
|
33
|
|
33
|
|
|
73
|
# work with Moose. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
shift->parameter; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__PACKAGE__->_ooify; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
|
62
|
0
|
|
|
0
|
0
|
|
|
|
63
|
|
|
|
|
|
|
# ABSTRACT: A class which represents parameterized constraints |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=pod |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=encoding UTF-8 |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 NAME |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Specio::Constraint::Parameterized - A class which represents parameterized constraints |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 VERSION |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
version 0.48 |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
my $arrayref = t('ArrayRef'); |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
my $arrayref_of_int = $arrayref->parameterize( of => t('Int') ); |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my $parent = $arrayref_of_int->parent; # returns ArrayRef |
|
85
|
|
|
|
|
|
|
my $parameter = $arrayref_of_int->parameter; # returns Int |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This class implements the API for parameterized types. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=for Pod::Coverage can_be_inlined type_parameter |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 API |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This class implements the same API as L<Specio::Constraint::Simple>, with a few |
|
96
|
|
|
|
|
|
|
additions. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 Specio::Constraint::Parameterized->new(...) |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This class's constructor accepts two additional parameters: |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=over 4 |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * parent |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This should be the L<Specio::Constraint::Parameterizable> object from which |
|
107
|
|
|
|
|
|
|
this object was created. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This parameter is required. |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item * parameter |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This is the type parameter for the parameterized type. This must be an object |
|
114
|
|
|
|
|
|
|
which does the L<Specio::Constraint::Role::Interface> role. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This parameter is required. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=back |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 $type->parameter |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Returns the type that was passed to the constructor. |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 SUPPORT |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/Specio/issues>. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 SOURCE |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
The source code repository for Specio can be found at L<https://github.com/houseabsolute/Specio>. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 AUTHOR |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This software is Copyright (c) 2012 - 2022 by Dave Rolsky. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This is free software, licensed under: |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
The full text of the license can be found in the |
|
145
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=cut |