1MooseX::Has::Sugar::SacUcshearriCno(n3t)ributed Perl DocMuomoesnetXa:t:iHoans::Sugar::Saccharin(3)
2
3
4
6 MooseX::Has::Sugar::Saccharin - Experimental sweetness
7
9 version 1.000006
10
12 This is a highly experimental sugaring module. No Guarantees of
13 stability.
14
15 use MooseX::Types::Moose qw( :all );
16 has name => rw Str, default { 1 };
17 has suffix => required rw Str;
18 has 'suffix', required rw Str;
19
20 Your choice.
21
23 ":default"
24 exports:
25
26 "ro", "rw", "required", "lazy", "lazy_build", "coerce", "weak_ref",
27 "auto_deref", "bare", "default", "init_arg", "predicate",
28 "clearer", "builder", "trigger"
29
31 "bare"
32 "bare" $Type
33 bare Str
34
35 equivalent to this
36
37 is => 'bare', isa => Str
38
39 "ro"
40 "ro" $Type
41 ro Str
42
43 equivalent to this
44
45 is => 'ro', isa => Str,
46
47 "rw"
48 "rw" $Type
49 rw Str
50
51 equivalent to this
52
53 is => 'rw', isa => Str
54
55 "required"
56 "required @rest"
57 this
58
59 required rw Str
60
61 is equivalent to this
62
63 required => 1, is => 'rw', isa => Str,
64
65 this
66
67 rw Str, required
68
69 is equivalent to this
70
71 is => 'rw', isa => Str , required => 1
72
73 "lazy"
74 "lazy @rest"
75 like "( lazy => 1 , @rest )"
76
77 "lazy_build"
78 "lazy_build @rest"
79 like "( lazy_build => 1, @rest )"
80
81 "weak_ref"
82 "weak_ref @rest"
83 like "( weak_ref => 1, @rest )"
84
85 "coerce"
86 "coerce @rest"
87 like "( coerce => 1, @rest )"
88
89 WARNING:
90
91 Conflicts with "MooseX::Types's" "coerce" method
92
93 "auto_deref"
94 "auto_deref @rest"
95 like "( auto_deref => 1, @rest )"
96
97 "builder"
98 "builder $buildername"
99 required rw Str, builder '_build_foo'
100
101 is like
102
103 builder => '_build_foo'
104
105 "predicate"
106 "predicate $predicatename"
107 see "builder"
108
109 "clearer"
110 "clearer $clearername"
111 see "builder"
112
113 "init_arg"
114 "init_arg $argname"
115 see "builder"
116
117 "default"
118 "default { $code }"
119 Examples:
120
121 default { 1 }
122 default { { } }
123 default { [ ] }
124 default { $_->otherfield }
125
126 $_ is localized as the same value as $_[0] for convenience ( usually
127 $self )
128
129 "trigger"
130 "trigger { $code }"
131 Works exactly like default.
132
134 MooseX::Has::Sugar
135 MooseX::Has::Sugar::Minimal
136 This module is not intended to be used in conjunction with
137 ::Sugar or ::Sugar::Minimal
138
139 We export many of the same symbols and its just not very sensible.
140
141 MooseX::Types
142 Moose::Util::TypeConstraints
143 due to exporting the "coerce" symbol, using us in the same scope as a
144 call to
145
146 use MooseX::Types ....
147
148 or
149 use Moose::Util::TypeConstraints
150
151 will result in a symbol collision.
152
153 We recommend using and creating proper type libraries instead, ( which
154 will absolve you entirely of the need to use MooseX::Types and
155 MooseX::Has::Sugar(::*)? in the same scope )
156
157 Perl 5.010 feature 'switch'
158 the keyword 'default' becomes part of Perl in both these cases:
159
160 use 5.010;
161 use feature qw( :switch );
162
163 As such, we can't have that keyword in that scenario.
164
166 Kent Fredric <kentnl@cpan.org>
167
169 This software is copyright (c) 2017 by Kent Fredric
170 <kentfredric@gmail.com>.
171
172 This is free software; you can redistribute it and/or modify it under
173 the same terms as the Perl 5 programming language system itself.
174
175
176
177perl v5.36.0 2022-07-22 MooseX::Has::Sugar::Saccharin(3)