line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# ABSTRACT: Keep our type tools organized |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use strict; |
5
|
19
|
|
|
19
|
|
117
|
use warnings; |
|
19
|
|
|
|
|
35
|
|
|
19
|
|
|
|
|
496
|
|
6
|
19
|
|
|
19
|
|
86
|
use Type::Library -base; |
|
19
|
|
|
|
|
35
|
|
|
19
|
|
|
|
|
523
|
|
7
|
19
|
|
|
19
|
|
7733
|
use Type::Utils -all; |
|
19
|
|
|
|
|
566619
|
|
|
19
|
|
|
|
|
205
|
|
8
|
19
|
|
|
19
|
|
13579
|
use Type::Params ':all'; |
|
19
|
|
|
|
|
156963
|
|
|
19
|
|
|
|
|
227
|
|
9
|
19
|
|
|
19
|
|
54673
|
|
|
19
|
|
|
|
|
1245493
|
|
|
19
|
|
|
|
|
225
|
|
10
|
|
|
|
|
|
|
# EXPORT_OK, but not :all |
11
|
|
|
|
|
|
|
use Types::Standard qw( |
12
|
19
|
|
|
|
|
130
|
slurpy |
13
|
|
|
|
|
|
|
); |
14
|
19
|
|
|
19
|
|
24210
|
|
|
19
|
|
|
|
|
45
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.34'; |
16
|
|
|
|
|
|
|
our @EXPORT_OK; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
BEGIN { |
19
|
|
|
|
|
|
|
extends qw( |
20
|
19
|
|
|
19
|
|
40017
|
Types::Standard |
21
|
|
|
|
|
|
|
Types::Common::Numeric |
22
|
|
|
|
|
|
|
Types::Common::String |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
push @EXPORT_OK => ( |
25
|
19
|
|
|
|
|
2068921
|
@Type::Params::EXPORT, |
26
|
|
|
|
|
|
|
@Type::Params::EXPORT_OK, |
27
|
|
|
|
|
|
|
@Types::Standard::EXPORT_OK, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
30
|
19
|
|
|
|
|
169
|
all => \@EXPORT_OK, |
31
|
|
|
|
|
|
|
Standard => [ Types::Standard->type_names ], |
32
|
|
|
|
|
|
|
Numeric => [ qw/Num Int Bool/, Types::Common::Numeric->type_names ], |
33
|
|
|
|
|
|
|
String => [ qw/Str/, Types::Common::String->type_names ], |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=pod |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=encoding UTF-8 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
MooseX::Extended::Types - Keep our type tools organized |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 VERSION |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
version 0.34 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 SYNOPSIS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
use MooseX::Extended; |
55
|
|
|
|
|
|
|
use MooseX::Extended::Types; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
use MooseX::Extended::Types qw( |
58
|
|
|
|
|
|
|
ArrayRef |
59
|
|
|
|
|
|
|
Dict |
60
|
|
|
|
|
|
|
Enum |
61
|
|
|
|
|
|
|
HashRef |
62
|
|
|
|
|
|
|
InstanceOf |
63
|
|
|
|
|
|
|
Str |
64
|
|
|
|
|
|
|
compile |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
As a convenience, if you're using L<MooseX::Extended>, you can do this: |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
use MooseX::Extended types => [qw( |
70
|
|
|
|
|
|
|
ArrayRef |
71
|
|
|
|
|
|
|
Dict |
72
|
|
|
|
|
|
|
Enum |
73
|
|
|
|
|
|
|
HashRef |
74
|
|
|
|
|
|
|
InstanceOf |
75
|
|
|
|
|
|
|
Str |
76
|
|
|
|
|
|
|
compile |
77
|
|
|
|
|
|
|
)]; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
If you're brave: |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
use MooseX::Extended types => ':all'; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
But that exports I<everything> and it's easy to have surprising conflicts. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 DESCRIPTION |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
A basic set of useful types for C<MooseX::Extended>, as provided by |
88
|
|
|
|
|
|
|
L<Type::Tiny>. Using these is preferred to using using strings due to runtime |
89
|
|
|
|
|
|
|
versus compile-time failures. For example: |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# fails at runtime, if ->name is set |
92
|
|
|
|
|
|
|
param name => ( isa => 'str' ); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
# fails at compile-time |
95
|
|
|
|
|
|
|
param name => ( isa => str ); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 TYPE LIBRARIES |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
We automatically include the types from the following: |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=over |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item * L<Types::Standard> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
You can import them individually or with the C<:Standard> tag: |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
use MooseX::Extended::Types types => 'Str'; |
108
|
|
|
|
|
|
|
use MooseX::Extended::Types types => [ 'Str', 'ArrayRef' ]; |
109
|
|
|
|
|
|
|
use MooseX::Extended::Types types => ':Standard'; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Using the C<:Standard> tag is equivalent to: |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
use Types::Standard; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
No import list is supplied directly to the module, so non-default type |
116
|
|
|
|
|
|
|
functions must be asked for by name. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item * L<Types::Common::Numeric> |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
You can import them individually or with the C<:Numeric> tag: |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
use MooseX::Extended::Types types => 'Int'; |
123
|
|
|
|
|
|
|
use MooseX::Extended::Types types => [ 'Int', 'NegativeOrZeroNum' ]; |
124
|
|
|
|
|
|
|
use MooseX::Extended::Types types => ':Numeric'; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Using the C<:Numeric> tag is equivalent to: |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
use Types::Common::Numeric; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
No import list is supplied directly to the module, so non-default type |
131
|
|
|
|
|
|
|
functions must be asked for by name. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item * L<Types::Common::String> |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
You can import them individually or with the C<:String> tag: |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
use MooseX::Extended::Types types => 'NonEmptyStr'; |
138
|
|
|
|
|
|
|
use MooseX::Extended::Types types => [ 'NonEmptyStr', 'UpperCaseStr' ]; |
139
|
|
|
|
|
|
|
use MooseX::Extended::Types types => ':String'; |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Using the C<:String> tag is equivalent to: |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
use Types::Common::String; |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
No import list is supplied directly to the module, so non-default type |
146
|
|
|
|
|
|
|
functions must be asked for by name. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=back |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 EXTRAS |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
The following extra functions are exported on demand or if using the C<:all> |
153
|
|
|
|
|
|
|
export tag (but you probably don't want to use that tag). |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 L<Type::Params> |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=over |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item * C<compile> |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item * C<compile_named> |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=item * C<multisig> |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=item * C<validate> |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item * C<validate_named> |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=item * C<compile_named_oo> |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item * C<Invocant> |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=item * C<wrap_subs> |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=item * C<wrap_methods> |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=item * C<ArgsObject> |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=back |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head2 L<Types::Standard> |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=over 4 |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=item * C<slurpy> |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=back |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head1 AUTHOR |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Curtis "Ovid" Poe <curtis.poe@gmail.com> |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
This software is Copyright (c) 2022 by Curtis "Ovid" Poe. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
This is free software, licensed under: |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=cut |