ec45de7746bbcbf865ff714223169e4418c270cd
[catagits/Gitalist.git] / local-lib5 / man / man3 / Moose::Cookbook::Snack::Keywords.3pm
1 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.3
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sh \" Subsection heading
6 .br
7 .if t .Sp
8 .ne 5
9 .PP
10 \fB\\$1\fR
11 .PP
12 ..
13 .de Sp \" Vertical space (when we can't use .PP)
14 .if t .sp .5v
15 .if n .sp
16 ..
17 .de Vb \" Begin verbatim text
18 .ft CW
19 .nf
20 .ne \\$1
21 ..
22 .de Ve \" End verbatim text
23 .ft R
24 .fi
25 ..
26 .\" Set up some character translations and predefined strings.  \*(-- will
27 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28 .\" double quote, and \*(R" will give a right double quote.  | will give a
29 .\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
30 .\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
31 .\" expand to `' in nroff, nothing in troff, for use with C<>.
32 .tr \(*W-|\(bv\*(Tr
33 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34 .ie n \{\
35 .    ds -- \(*W-
36 .    ds PI pi
37 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
39 .    ds L" ""
40 .    ds R" ""
41 .    ds C` ""
42 .    ds C' ""
43 'br\}
44 .el\{\
45 .    ds -- \|\(em\|
46 .    ds PI \(*p
47 .    ds L" ``
48 .    ds R" ''
49 'br\}
50 .\"
51 .\" If the F register is turned on, we'll generate index entries on stderr for
52 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53 .\" entries marked with X<> in POD.  Of course, you'll have to process the
54 .\" output yourself in some meaningful fashion.
55 .if \nF \{\
56 .    de IX
57 .    tm Index:\\$1\t\\n%\t"\\$2"
58 ..
59 .    nr % 0
60 .    rr F
61 .\}
62 .\"
63 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
64 .\" way too many mistakes in technical documents.
65 .hy 0
66 .if n .na
67 .\"
68 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
70 .    \" fudge factors for nroff and troff
71 .if n \{\
72 .    ds #H 0
73 .    ds #V .8m
74 .    ds #F .3m
75 .    ds #[ \f1
76 .    ds #] \fP
77 .\}
78 .if t \{\
79 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80 .    ds #V .6m
81 .    ds #F 0
82 .    ds #[ \&
83 .    ds #] \&
84 .\}
85 .    \" simple accents for nroff and troff
86 .if n \{\
87 .    ds ' \&
88 .    ds ` \&
89 .    ds ^ \&
90 .    ds , \&
91 .    ds ~ ~
92 .    ds /
93 .\}
94 .if t \{\
95 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101 .\}
102 .    \" troff and (daisy-wheel) nroff accents
103 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110 .ds ae a\h'-(\w'a'u*4/10)'e
111 .ds Ae A\h'-(\w'A'u*4/10)'E
112 .    \" corrections for vroff
113 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115 .    \" for low resolution devices (crt and lpr)
116 .if \n(.H>23 .if \n(.V>19 \
117 \{\
118 .    ds : e
119 .    ds 8 ss
120 .    ds o a
121 .    ds d- d\h'-1'\(ga
122 .    ds D- D\h'-1'\(hy
123 .    ds th \o'bp'
124 .    ds Th \o'LP'
125 .    ds ae ae
126 .    ds Ae AE
127 .\}
128 .rm #[ #] #H #V #F C
129 .\" ========================================================================
130 .\"
131 .IX Title "Moose::Cookbook::Snack::Keywords 3"
132 .TH Moose::Cookbook::Snack::Keywords 3 "2009-03-14" "perl v5.8.7" "User Contributed Perl Documentation"
133 .SH "NAME"
134 Moose::Cookbook::Snack::Keywords \- Restricted "keywords" in Moose
135 .SH "DESCRIPTION"
136 .IX Header "DESCRIPTION"
137 Moose exports a number of sugar functions in order to emulate Perl
138 built-in keywords. These can cause clashes with other user-defined
139 functions. This document provides a list of those keywords for easy
140 reference.
141 .Sh "The 'meta' keyword"
142 .IX Subsection "The 'meta' keyword"
143 While most collisions can be avoided, you cannot avoid importing a
144 \&\f(CW\*(C`meta\*(C'\fR method when you \f(CW\*(C`use\ Moose\*(C'\fR. If you try to override or
145 change what \f(CW\*(C`meta\*(C'\fR does, you could end up breaking Moose internals.
146 .Sh "Moose Keywords"
147 .IX Subsection "Moose Keywords"
148 If you are using Moose or Moose::Role its best to avoid these
149 keywords:
150 .IP "extends" 4
151 .IX Item "extends"
152 .PD 0
153 .IP "with" 4
154 .IX Item "with"
155 .IP "has" 4
156 .IX Item "has"
157 .IP "before" 4
158 .IX Item "before"
159 .IP "after" 4
160 .IX Item "after"
161 .IP "around" 4
162 .IX Item "around"
163 .IP "super" 4
164 .IX Item "super"
165 .IP "override" 4
166 .IX Item "override"
167 .IP "inner" 4
168 .IX Item "inner"
169 .IP "augment" 4
170 .IX Item "augment"
171 .IP "confess" 4
172 .IX Item "confess"
173 .IP "blessed" 4
174 .IX Item "blessed"
175 .PD
176 .Sh "Moose::Util::TypeConstraints Keywords"
177 .IX Subsection "Moose::Util::TypeConstraints Keywords"
178 If you are using Moose::Util::TypeConstraints its best to avoid
179 these keywords
180 .IP "type" 4
181 .IX Item "type"
182 .PD 0
183 .IP "subtype" 4
184 .IX Item "subtype"
185 .IP "class_type" 4
186 .IX Item "class_type"
187 .IP "role_type" 4
188 .IX Item "role_type"
189 .IP "maybe_type" 4
190 .IX Item "maybe_type"
191 .IP "as" 4
192 .IX Item "as"
193 .IP "where" 4
194 .IX Item "where"
195 .IP "message" 4
196 .IX Item "message"
197 .IP "optimize_as" 4
198 .IX Item "optimize_as"
199 .IP "coerce" 4
200 .IX Item "coerce"
201 .IP "from" 4
202 .IX Item "from"
203 .IP "via" 4
204 .IX Item "via"
205 .IP "enum" 4
206 .IX Item "enum"
207 .IP "find_type_constraint" 4
208 .IX Item "find_type_constraint"
209 .IP "register_type_constraint" 4
210 .IX Item "register_type_constraint"
211 .PD
212 .Sh "Avoiding collisions"
213 .IX Subsection "Avoiding collisions"
214 \fITurning off Moose\fR
215 .IX Subsection "Turning off Moose"
216 .PP
217 To remove the sugar functions Moose exports just add \f(CW\*(C`no\ Moose\*(C'\fR
218 at the bottom of your code:
219 .PP
220 .Vb 2
221 \&  package Thing;
222 \&  use Moose;
223 .Ve
224 .PP
225 .Vb 1
226 \&  # code here
227 .Ve
228 .PP
229 .Vb 1
230 \&  no Moose;
231 .Ve
232 .PP
233 This will unexport the sugar functions that Moose originally
234 exported. The same will also work for Moose::Role and
235 Moose::Util::TypeConstraints.
236 .PP
237 \fISub::Exporter features\fR
238 .IX Subsection "Sub::Exporter features"
239 .PP
240 Moose, Moose::Role and Moose::Util::TypeConstraints all use
241 Sub::Exporter to handle all their exporting needs. This means that
242 all the features that Sub::Exporter provides are also available to
243 them.
244 .PP
245 For instance, with Sub::Exporter you can rename keywords, like so:
246 .PP
247 .Vb 2
248 \&  package LOL::Cat;
249 \&  use Moose 'has' => { \-as => 'i_can_haz' };
250 .Ve
251 .PP
252 .Vb 4
253 \&  i_can_haz 'cheeseburger' => (
254 \&      is      => 'rw',
255 \&      trigger => sub { print "NOM NOM" }
256 \&  );
257 .Ve
258 .PP
259 .Vb 1
260 \&  LOL::Cat\->new\->cheeseburger('KTHNXBYE');
261 .Ve
262 .PP
263 See the Sub::Exporter docs for more information.
264 .PP
265 \fInamespace::clean\fR
266 .IX Subsection "namespace::clean"
267 .PP
268 You can also use namespace::clean to clean up your namespace, but
269 you must be careful not to remove \f(CW\*(C`meta\*(C'\fR when doing so:
270 .PP
271 .Vb 4
272 \&  package Foo;
273 \&  use Moose;
274 \&  use namespace::clean \-except => 'meta';
275 \&  # ...
276 .Ve
277 .SH "SEE ALSO"
278 .IX Header "SEE ALSO"
279 .IP "Moose" 4
280 .IX Item "Moose"
281 .PD 0
282 .IP "Moose::Role" 4
283 .IX Item "Moose::Role"
284 .IP "Moose::Utils::TypeConstraints" 4
285 .IX Item "Moose::Utils::TypeConstraints"
286 .IP "Sub::Exporter" 4
287 .IX Item "Sub::Exporter"
288 .IP "namespace::clean" 4
289 .IX Item "namespace::clean"
290 .PD
291 .SH "AUTHOR"
292 .IX Header "AUTHOR"
293 John Goulah \f(CW\*(C`<jgoulah@cpan.org<gt\*(C'\fR>
294 .PP
295 Stevan Little <stevan@iinteractive.com>
296 .SH "COPYRIGHT AND LICENSE"
297 .IX Header "COPYRIGHT AND LICENSE"
298 Copyright 2006\-2009 by Infinity Interactive, Inc.
299 .PP
300 <http://www.iinteractive.com>
301 .PP
302 This library is free software; you can redistribute it and/or modify
303 it under the same terms as Perl itself.