line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
4
|
|
|
4
|
|
20
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
92
|
|
4
|
4
|
|
|
4
|
|
16
|
|
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
165
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.48'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use List::Util qw( all ); |
8
|
4
|
|
|
4
|
|
20
|
use Role::Tiny::With; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
189
|
|
9
|
4
|
|
|
4
|
|
22
|
use Specio::OO; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
130
|
|
10
|
4
|
|
|
4
|
|
19
|
use Specio::TypeChecks qw( does_role ); |
|
4
|
|
|
|
|
376
|
|
|
4
|
|
|
|
|
177
|
|
11
|
4
|
|
|
4
|
|
89
|
use Storable qw( dclone ); |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
132
|
|
12
|
4
|
|
|
4
|
|
19
|
|
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
128
|
|
13
|
|
|
|
|
|
|
use Specio::Constraint::Role::Interface; |
14
|
4
|
|
|
4
|
|
19
|
with 'Specio::Constraint::Role::Interface'; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
528
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
{ |
17
|
|
|
|
|
|
|
## no critic (Subroutines::ProtectPrivateSubs) |
18
|
|
|
|
|
|
|
my $attrs = dclone( Specio::Constraint::Role::Interface::_attrs() ); |
19
|
|
|
|
|
|
|
## use critic |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$attrs->{parent}{isa} = 'Specio::Constraint::Structurable'; |
22
|
|
|
|
|
|
|
$attrs->{parent}{required} = 1; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
$attrs->{parameters} = { |
25
|
|
|
|
|
|
|
isa => 'HashRef', |
26
|
|
|
|
|
|
|
required => 1, |
27
|
|
|
|
|
|
|
}; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) |
30
|
|
|
|
|
|
|
return $attrs; |
31
|
|
|
|
|
|
|
} |
32
|
8
|
|
|
8
|
|
17
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $self = shift; |
35
|
|
|
|
|
|
|
return $self->_has_inline_generator; |
36
|
|
|
|
|
|
|
} |
37
|
40
|
|
|
40
|
0
|
207
|
|
38
|
40
|
|
|
|
|
86
|
__PACKAGE__->_ooify; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# ABSTRACT: A class which represents structured constraints |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=pod |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=encoding UTF-8 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Specio::Constraint::Structured - A class which represents structured constraints |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 VERSION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
version 0.48 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 SYNOPSIS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
my $tuple = t('Tuple'); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $tuple_of_str_int = $tuple->parameterize( of => [ t('Str'), t('Int') ] ); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my $parent = $tuple_of_str_int->parent; # returns Tuple |
64
|
|
|
|
|
|
|
my $parameters = $arrayref_of_int->parameters; # returns { of => [ t('Str'), t('Int') ] } |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 DESCRIPTION |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This class implements the API for structured types. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=for Pod::Coverage can_be_inlined type_parameter |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 API |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This class implements the same API as L<Specio::Constraint::Simple>, with a few |
75
|
|
|
|
|
|
|
additions. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 Specio::Constraint::Structured->new(...) |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This class's constructor accepts two additional parameters: |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=over 4 |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item * parent |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This should be the L<Specio::Constraint::Structurable> object from which this |
86
|
|
|
|
|
|
|
object was created. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This parameter is required. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item * parameters |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This is the hashref of parameters for the structured type. These are the |
93
|
|
|
|
|
|
|
parameters returned by the C<Structurable> type's |
94
|
|
|
|
|
|
|
C<parameterization_args_builder>. The exact form of this hashref will vary for |
95
|
|
|
|
|
|
|
each structured type. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This parameter is required. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=back |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 $type->parameters |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Returns the hashref that was passed to the constructor. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 SUPPORT |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/Specio/issues>. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 SOURCE |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
The source code repository for Specio can be found at L<https://github.com/houseabsolute/Specio>. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 AUTHOR |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
This software is Copyright (c) 2012 - 2022 by Dave Rolsky. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
This is free software, licensed under: |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
The full text of the license can be found in the |
126
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |