1MooseX::Extended::TypesU(s3e)r Contributed Perl DocumentaMtoioosneX::Extended::Types(3)
2
3
4
6 MooseX::Extended::Types - Keep our type tools organized
7
9 version 0.35
10
12 use MooseX::Extended;
13 use MooseX::Extended::Types;
14
15 use MooseX::Extended::Types qw(
16 ArrayRef
17 Dict
18 Enum
19 HashRef
20 InstanceOf
21 Str
22 compile
23 );
24
25 As a convenience, if you're using MooseX::Extended, you can do this:
26
27 use MooseX::Extended types => [qw(
28 ArrayRef
29 Dict
30 Enum
31 HashRef
32 InstanceOf
33 Str
34 compile
35 )];
36
37 If you're brave:
38
39 use MooseX::Extended types => ':all';
40
41 But that exports everything and it's easy to have surprising conflicts.
42
44 A basic set of useful types for "MooseX::Extended", as provided by
45 Type::Tiny. Using these is preferred to using using strings due to
46 runtime versus compile-time failures. For example:
47
48 # fails at runtime, if ->name is set
49 param name => ( isa => 'str' );
50
51 # fails at compile-time
52 param name => ( isa => str );
53
55 We automatically include the types from the following:
56
57 • Types::Standard
58
59 You can import them individually or with the ":Standard" tag:
60
61 use MooseX::Extended::Types types => 'Str';
62 use MooseX::Extended::Types types => [ 'Str', 'ArrayRef' ];
63 use MooseX::Extended::Types types => ':Standard';
64
65 Using the ":Standard" tag is equivalent to:
66
67 use Types::Standard;
68
69 No import list is supplied directly to the module, so non-default
70 type functions must be asked for by name.
71
72 • Types::Common::Numeric
73
74 You can import them individually or with the ":Numeric" tag:
75
76 use MooseX::Extended::Types types => 'Int';
77 use MooseX::Extended::Types types => [ 'Int', 'NegativeOrZeroNum' ];
78 use MooseX::Extended::Types types => ':Numeric';
79
80 Using the ":Numeric" tag is equivalent to:
81
82 use Types::Common::Numeric;
83
84 No import list is supplied directly to the module, so non-default
85 type functions must be asked for by name.
86
87 • Types::Common::String
88
89 You can import them individually or with the ":String" tag:
90
91 use MooseX::Extended::Types types => 'NonEmptyStr';
92 use MooseX::Extended::Types types => [ 'NonEmptyStr', 'UpperCaseStr' ];
93 use MooseX::Extended::Types types => ':String';
94
95 Using the ":String" tag is equivalent to:
96
97 use Types::Common::String;
98
99 No import list is supplied directly to the module, so non-default
100 type functions must be asked for by name.
101
103 The following extra functions are exported on demand or if using the
104 ":all" export tag (but you probably don't want to use that tag).
105
106 Type::Params
107 • "compile"
108
109 • "compile_named"
110
111 • "multisig"
112
113 • "validate"
114
115 • "validate_named"
116
117 • "compile_named_oo"
118
119 • "Invocant"
120
121 • "wrap_subs"
122
123 • "wrap_methods"
124
125 • "ArgsObject"
126
127 Types::Standard
128 • "slurpy"
129
131 Curtis "Ovid" Poe <curtis.poe@gmail.com>
132
134 This software is Copyright (c) 2022 by Curtis "Ovid" Poe.
135
136 This is free software, licensed under:
137
138 The Artistic License 2.0 (GPL Compatible)
139
140
141
142perl v5.36.1 2023-06-26 MooseX::Extended::Types(3)