Add built local::lib
[catagits/Gitalist.git] / local-lib5 / man / man3 / Mouse.3pm
1 .\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.10)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
18 .\" Set up some character translations and predefined strings.  \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
29 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 'br\}
42 .\"
43 .\" Escape single quotes in literal strings from groff's Unicode transform.
44 .ie \n(.g .ds Aq \(aq
45 .el       .ds Aq '
46 .\"
47 .\" If the F register is turned on, we'll generate index entries on stderr for
48 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
49 .\" entries marked with X<> in POD.  Of course, you'll have to process the
50 .\" output yourself in some meaningful fashion.
51 .ie \nF \{\
52 .    de IX
53 .    tm Index:\\$1\t\\n%\t"\\$2"
54 ..
55 .    nr % 0
56 .    rr F
57 .\}
58 .el \{\
59 .    de IX
60 ..
61 .\}
62 .\"
63 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
64 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
65 .    \" fudge factors for nroff and troff
66 .if n \{\
67 .    ds #H 0
68 .    ds #V .8m
69 .    ds #F .3m
70 .    ds #[ \f1
71 .    ds #] \fP
72 .\}
73 .if t \{\
74 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
75 .    ds #V .6m
76 .    ds #F 0
77 .    ds #[ \&
78 .    ds #] \&
79 .\}
80 .    \" simple accents for nroff and troff
81 .if n \{\
82 .    ds ' \&
83 .    ds ` \&
84 .    ds ^ \&
85 .    ds , \&
86 .    ds ~ ~
87 .    ds /
88 .\}
89 .if t \{\
90 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
91 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
92 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
93 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
94 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
95 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
96 .\}
97 .    \" troff and (daisy-wheel) nroff accents
98 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
99 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
100 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
101 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
102 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
103 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
104 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
105 .ds ae a\h'-(\w'a'u*4/10)'e
106 .ds Ae A\h'-(\w'A'u*4/10)'E
107 .    \" corrections for vroff
108 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
109 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
110 .    \" for low resolution devices (crt and lpr)
111 .if \n(.H>23 .if \n(.V>19 \
112 \{\
113 .    ds : e
114 .    ds 8 ss
115 .    ds o a
116 .    ds d- d\h'-1'\(ga
117 .    ds D- D\h'-1'\(hy
118 .    ds th \o'bp'
119 .    ds Th \o'LP'
120 .    ds ae ae
121 .    ds Ae AE
122 .\}
123 .rm #[ #] #H #V #F C
124 .\" ========================================================================
125 .\"
126 .IX Title "Mouse 3"
127 .TH Mouse 3 "2009-12-07" "perl v5.8.7" "User Contributed Perl Documentation"
128 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
129 .\" way too many mistakes in technical documents.
130 .if n .ad l
131 .nh
132 .SH "NAME"
133 Mouse \- Moose minus the antlers
134 .SH "VERSION"
135 .IX Header "VERSION"
136 This document describes Mouse version 0.43
137 .SH "SYNOPSIS"
138 .IX Header "SYNOPSIS"
139 .Vb 2
140 \&    package Point;
141 \&    use Mouse; # automatically turns on strict and warnings
142 \&
143 \&    has \*(Aqx\*(Aq => (is => \*(Aqrw\*(Aq, isa => \*(AqInt\*(Aq);
144 \&    has \*(Aqy\*(Aq => (is => \*(Aqrw\*(Aq, isa => \*(AqInt\*(Aq);
145 \&
146 \&    sub clear {
147 \&        my $self = shift;
148 \&        $self\->x(0);
149 \&        $self\->y(0);
150 \&    }
151 \&
152 \&    package Point3D;
153 \&    use Mouse;
154 \&
155 \&    extends \*(AqPoint\*(Aq;
156 \&
157 \&    has \*(Aqz\*(Aq => (is => \*(Aqrw\*(Aq, isa => \*(AqInt\*(Aq);
158 \&
159 \&    after \*(Aqclear\*(Aq => sub {
160 \&        my $self = shift;
161 \&        $self\->z(0);
162 \&    };
163 .Ve
164 .SH "DESCRIPTION"
165 .IX Header "DESCRIPTION"
166 Moose is wonderful. \fBUse Moose instead of Mouse.\fR
167 .PP
168 Unfortunately, Moose has a compile-time penalty. Though significant progress
169 has been made over the years, the compile time penalty is a non-starter for
170 some very specific applications. If you are writing a command-line application
171 or \s-1CGI\s0 script where startup time is essential, you may not be able to use
172 Moose. We recommend that you instead use HTTP::Engine and FastCGI for the
173 latter, if possible.
174 .PP
175 Mouse aims to alleviate this by providing a subset of Moose's functionality,
176 faster.
177 .PP
178 We're also going as light on dependencies as possible. Mouse currently has
179 \&\fBno dependencies\fR except for testing modules.
180 .SS "\s-1MOOSE\s0 \s-1COMPATIBILITY\s0"
181 .IX Subsection "MOOSE COMPATIBILITY"
182 Compatibility with Moose has been the utmost concern. Fewer than 1% of the
183 tests fail when run against Moose instead of Mouse. Mouse code coverage is also
184 over 96%. Even the error messages are taken from Moose. The Mouse code just
185 runs the test suite 4x faster.
186 .PP
187 The idea is that, if you need the extra power, you should be able to run
188 \&\f(CW\*(C`s/Mouse/Moose/g\*(C'\fR on your codebase and have nothing break. To that end,
189 we have written Any::Moose which will act as Mouse unless Moose is loaded,
190 in which case it will act as Moose. Since Mouse is a little sloppier than
191 Moose, if you run into weird errors, it would be worth running:
192 .PP
193 .Vb 1
194 \&    ANY_MOOSE=Moose perl your\-script.pl
195 .Ve
196 .PP
197 to see if the bug is caused by Mouse. Moose's diagnostics and validation are
198 also much better.
199 .PP
200 See also Mouse::Spec for compatibility and incompatibility with Moose.
201 .SS "MouseX"
202 .IX Subsection "MouseX"
203 Please don't copy MooseX code to MouseX. If you need extensions, you really
204 should upgrade to Moose. We don't need two parallel sets of extensions!
205 .PP
206 If you really must write a Mouse extension, please contact the Moose mailing
207 list or #moose on \s-1IRC\s0 beforehand.
208 .SH "KEYWORDS"
209 .IX Header "KEYWORDS"
210 .ie n .SS """$object\->meta \-> Mouse::Meta::Class"""
211 .el .SS "\f(CW$object\->meta \-> Mouse::Meta::Class\fP"
212 .IX Subsection "$object->meta -> Mouse::Meta::Class"
213 Returns this class' metaclass instance.
214 .ie n .SS """extends superclasses"""
215 .el .SS "\f(CWextends superclasses\fP"
216 .IX Subsection "extends superclasses"
217 Sets this class' superclasses.
218 .ie n .SS """before (method|methods) => CodeRef"""
219 .el .SS "\f(CWbefore (method|methods) => CodeRef\fP"
220 .IX Subsection "before (method|methods) => CodeRef"
221 Installs a \*(L"before\*(R" method modifier. See \*(L"before\*(R" in Moose.
222 .ie n .SS """after (method|methods) => CodeRef"""
223 .el .SS "\f(CWafter (method|methods) => CodeRef\fP"
224 .IX Subsection "after (method|methods) => CodeRef"
225 Installs an \*(L"after\*(R" method modifier. See \*(L"after\*(R" in Moose.
226 .ie n .SS """around (method|methods) => CodeRef"""
227 .el .SS "\f(CWaround (method|methods) => CodeRef\fP"
228 .IX Subsection "around (method|methods) => CodeRef"
229 Installs an \*(L"around\*(R" method modifier. See \*(L"around\*(R" in Moose.
230 .ie n .SS """has (name|names) => parameters"""
231 .el .SS "\f(CWhas (name|names) => parameters\fP"
232 .IX Subsection "has (name|names) => parameters"
233 Adds an attribute (or if passed an arrayref of names, multiple attributes) to
234 this class. Options:
235 .ie n .IP """is => ro|rw|bare""" 4
236 .el .IP "\f(CWis => ro|rw|bare\fR" 4
237 .IX Item "is => ro|rw|bare"
238 The \fIis\fR option accepts either \fIrw\fR (for read/write), \fIro\fR (for read
239 only) or \fIbare\fR (for nothing). These will create either a read/write accessor
240 or a read-only accessor respectively, using the same name as the \f(CW$name\fR of
241 the attribute.
242 .Sp
243 If you need more control over how your accessors are named, you can
244 use the \f(CW\*(C`reader\*(C'\fR, \f(CW\*(C`writer\*(C'\fR and \f(CW\*(C`accessor\*(C'\fR options, however if you
245 use those, you won't need the \fIis\fR option.
246 .ie n .IP """isa => TypeName | ClassName""" 4
247 .el .IP "\f(CWisa => TypeName | ClassName\fR" 4
248 .IX Item "isa => TypeName | ClassName"
249 Provides type checking in the constructor and accessor. The following types are
250 supported. Any unknown type is taken to be a class check
251 (e.g. \f(CW\*(C`isa => \*(AqDateTime\*(Aq\*(C'\fR would accept only DateTime objects).
252 .Sp
253 .Vb 3
254 \&    Any Item Bool Undef Defined Value Num Int Str ClassName
255 \&    Ref ScalarRef ArrayRef HashRef CodeRef RegexpRef GlobRef
256 \&    FileHandle Object
257 .Ve
258 .Sp
259 For more documentation on type constraints, see Mouse::Util::TypeConstraints.
260 .ie n .IP """does => RoleName""" 4
261 .el .IP "\f(CWdoes => RoleName\fR" 4
262 .IX Item "does => RoleName"
263 This will accept the name of a role which the value stored in this attribute
264 is expected to have consumed.
265 .ie n .IP """coerce => Bool""" 4
266 .el .IP "\f(CWcoerce => Bool\fR" 4
267 .IX Item "coerce => Bool"
268 This will attempt to use coercion with the supplied type constraint to change
269 the value passed into any accessors or constructors. You \fBmust\fR have supplied
270 a type constraint in order for this to work. See Moose::Cookbook::Basics::Recipe5
271 for an example.
272 .ie n .IP """required => Bool""" 4
273 .el .IP "\f(CWrequired => Bool\fR" 4
274 .IX Item "required => Bool"
275 Whether this attribute is required to have a value. If the attribute is lazy or
276 has a builder, then providing a value for the attribute in the constructor is
277 optional.
278 .ie n .IP """init_arg => Str | Undef""" 4
279 .el .IP "\f(CWinit_arg => Str | Undef\fR" 4
280 .IX Item "init_arg => Str | Undef"
281 Allows you to use a different key name in the constructor.  If undef, the
282 attribute can't be passed to the constructor.
283 .ie n .IP """default => Value | CodeRef""" 4
284 .el .IP "\f(CWdefault => Value | CodeRef\fR" 4
285 .IX Item "default => Value | CodeRef"
286 Sets the default value of the attribute. If the default is a coderef, it will
287 be invoked to get the default value. Due to quirks of Perl, any bare reference
288 is forbidden, you must wrap the reference in a coderef. Otherwise, all
289 instances will share the same reference.
290 .ie n .IP """lazy => Bool""" 4
291 .el .IP "\f(CWlazy => Bool\fR" 4
292 .IX Item "lazy => Bool"
293 If specified, the default is calculated on demand instead of in the
294 constructor.
295 .ie n .IP """predicate => Str""" 4
296 .el .IP "\f(CWpredicate => Str\fR" 4
297 .IX Item "predicate => Str"
298 Lets you specify a method name for installing a predicate method, which checks
299 that the attribute has a value. It will not invoke a lazy default or builder
300 method.
301 .ie n .IP """clearer => Str""" 4
302 .el .IP "\f(CWclearer => Str\fR" 4
303 .IX Item "clearer => Str"
304 Lets you specify a method name for installing a clearer method, which clears
305 the attribute's value from the instance. On the next read, lazy or builder will
306 be invoked.
307 .ie n .IP """handles => HashRef|ArrayRef|Regexp""" 4
308 .el .IP "\f(CWhandles => HashRef|ArrayRef|Regexp\fR" 4
309 .IX Item "handles => HashRef|ArrayRef|Regexp"
310 Lets you specify methods to delegate to the attribute. ArrayRef forwards the
311 given method names to method calls on the attribute. HashRef maps local method
312 names to remote method names called on the attribute. Other forms of
313 \&\*(L"handles\*(R", such as RoleName and CodeRef, are not yet supported.
314 .ie n .IP """weak_ref => Bool""" 4
315 .el .IP "\f(CWweak_ref => Bool\fR" 4
316 .IX Item "weak_ref => Bool"
317 Lets you automatically weaken any reference stored in the attribute.
318 .Sp
319 Use of this feature requires Scalar::Util!
320 .ie n .IP """trigger => CodeRef""" 4
321 .el .IP "\f(CWtrigger => CodeRef\fR" 4
322 .IX Item "trigger => CodeRef"
323 Any time the attribute's value is set (either through the accessor or the constructor), the trigger is called on it. The trigger receives as arguments the instance, the new value, and the attribute instance.
324 .ie n .IP """builder => Str""" 4
325 .el .IP "\f(CWbuilder => Str\fR" 4
326 .IX Item "builder => Str"
327 Defines a method name to be called to provide the default value of the
328 attribute. \f(CW\*(C`builder => \*(Aqbuild_foo\*(Aq\*(C'\fR is mostly equivalent to
329 \&\f(CW\*(C`default => sub { $_[0]\->build_foo }\*(C'\fR.
330 .ie n .IP """auto_deref => Bool""" 4
331 .el .IP "\f(CWauto_deref => Bool\fR" 4
332 .IX Item "auto_deref => Bool"
333 Allows you to automatically dereference ArrayRef and HashRef attributes in list
334 context. In scalar context, the reference is returned (\s-1NOT\s0 the list length or
335 bucket status). You must specify an appropriate type constraint to use
336 auto_deref.
337 .ie n .IP """lazy_build => Bool""" 4
338 .el .IP "\f(CWlazy_build => Bool\fR" 4
339 .IX Item "lazy_build => Bool"
340 Automatically define the following options:
341 .Sp
342 .Vb 7
343 \&    has $attr => (
344 \&        # ...
345 \&        lazy      => 1
346 \&        builder   => "_build_$attr",
347 \&        clearer   => "clear_$attr",
348 \&        predicate => "has_$attr",
349 \&    );
350 .Ve
351 .ie n .SS """confess(message) \-> BOOM"""
352 .el .SS "\f(CWconfess(message) \-> BOOM\fP"
353 .IX Subsection "confess(message) -> BOOM"
354 \&\*(L"confess\*(R" in Carp for your convenience.
355 .ie n .SS """blessed(value) \-> ClassName | undef"""
356 .el .SS "\f(CWblessed(value) \-> ClassName | undef\fP"
357 .IX Subsection "blessed(value) -> ClassName | undef"
358 \&\*(L"blessed\*(R" in Scalar::Util for your convenience.
359 .SH "MISC"
360 .IX Header "MISC"
361 .SS "import"
362 .IX Subsection "import"
363 Importing Mouse will default your class' superclass list to Mouse::Object.
364 You may use \*(L"extends\*(R" to replace the superclass list.
365 .SS "unimport"
366 .IX Subsection "unimport"
367 Please unimport Mouse (\f(CW\*(C`no Mouse\*(C'\fR) so that if someone calls one of the
368 keywords (such as \*(L"extends\*(R") it will break loudly instead breaking subtly.
369 .SH "SOURCE CODE ACCESS"
370 .IX Header "SOURCE CODE ACCESS"
371 We have a public git repository:
372 .PP
373 .Vb 1
374 \& git clone git://git.moose.perl.org/Mouse.git
375 .Ve
376 .SH "DEPENDENCIES"
377 .IX Header "DEPENDENCIES"
378 Perl 5.6.2 or later.
379 .SH "SEE ALSO"
380 .IX Header "SEE ALSO"
381 Mouse::Spec
382 .PP
383 Moose
384 .PP
385 Moose::Manual
386 .PP
387 Moose::Cookbook
388 .PP
389 Class::MOP
390 .SH "AUTHORS"
391 .IX Header "AUTHORS"
392 Shawn M Moore <sartak at gmail.com>
393 .PP
394 Yuval Kogman <nothingmuch at woobling.org>
395 .PP
396 tokuhirom
397 .PP
398 Yappo
399 .PP
400 wu-lee
401 .PP
402 Goro Fuji (gfx) <gfuji at cpan.org>
403 .PP
404 with plenty of code borrowed from Class::MOP and Moose
405 .SH "BUGS"
406 .IX Header "BUGS"
407 All complex software has bugs lurking in it, and this module is no exception.
408 Please report any bugs to \f(CW\*(C`bug\-mouse at rt.cpan.org\*(C'\fR, or through the web
409 interface at <http://rt.cpan.org/Public/Dist/Display.html?Name=Mouse>
410 .SH "COPYRIGHT AND LICENSE"
411 .IX Header "COPYRIGHT AND LICENSE"
412 Copyright 2008\-2009 Infinity Interactive, Inc.
413 .PP
414 http://www.iinteractive.com/
415 .PP
416 This program is free software; you can redistribute it and/or modify it
417 under the same terms as Perl itself.