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