1 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.3
4 .\" ========================================================================
5 .de Sh \" Subsection heading
13 .de Sp \" Vertical space (when we can't use .PP)
17 .de Vb \" Begin verbatim text
22 .de Ve \" End verbatim text
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<>.
33 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
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
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.
57 . tm Index:\\$1\t\\n%\t"\\$2"
63 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
64 .\" way too many mistakes in technical documents.
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
79 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
85 . \" simple accents for nroff and troff
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'
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 \
129 .\" ========================================================================
131 .IX Title "Moose::Meta::Attribute::Native 3"
132 .TH Moose::Meta::Attribute::Native 3 "2009-11-19" "perl v5.8.7" "User Contributed Perl Documentation"
134 Moose::Meta::Attribute::Native \- Extend your attribute interfaces
136 .IX Header "SYNOPSIS"
143 \& has 'mapping' => (
144 \& traits => [ 'Hash' ],
146 \& isa => 'HashRef[Str]',
147 \& default => sub { {} },
149 \& exists_in_mapping => 'exists',
150 \& ids_in_mapping => 'keys',
151 \& get_mapping => 'get',
152 \& set_mapping => 'set',
153 \& set_quantity => [ set => 'quantity' ],
163 \& my $obj = MyClass\->new;
164 \& $obj\->set_quantity(10); # quantity => 10
165 \& $obj\->set_mapping('foo', 4); # foo => 4
166 \& $obj\->set_mapping('bar', 5); # bar => 5
167 \& $obj\->set_mapping('baz', 6); # baz => 6
172 \& print $obj\->get_mapping('bar') if $obj\->exists_in_mapping('bar');
176 \& # prints 'quantity, foo, bar, baz'
177 \& print join ', ', $obj\->ids_in_mapping;
180 .IX Header "DESCRIPTION"
181 While Moose attributes provide a way to name your accessors, readers,
182 writers, clearers and predicates, this set of traits provides commonly
183 used attribute helper methods for more specific types of data.
185 As seen in the \*(L"\s-1SYNOPSIS\s0\*(R", you specify the data structure via the
186 \&\f(CW\*(C`trait\*(C'\fR parameter. Available traits are below; see \*(L"\s-1METHOD\s0 \s-1PROVIDERS\s0\*(R".
188 This module used to exist as the MooseX::AttributeHelpers extension. It was
189 very commonly used, so we moved it into core Moose. Since this gave us a chance
190 to change the interface, you will have to change your code or continue using
191 the MooseX::AttributeHelpers extension. MooseX::AttributeHelpers should
194 .IX Header "PARAMETERS"
196 .IX Subsection "handles"
197 This is like \f(CW\*(C`handles\*(C'\fR in \*(L"has\*(R" in Moose, but only \s-1HASH\s0 references are
198 allowed. Keys are method names that you want installed locally, and values are
199 methods from the method providers (below). Currying with delegated methods
200 works normally for \f(CW\*(C`handles\*(C'\fR.
201 .SH "METHOD PROVIDERS"
202 .IX Header "METHOD PROVIDERS"
205 Common numerical operations.
208 \& has 'integer' => (
209 \& traits => ['Number'],
226 Common methods for string operations.
230 \& traits => ['String'],
235 \& add_text => 'append',
236 \& replace_text => 'replace',
242 Methods for incrementing and decrementing a counter attribute.
245 \& has 'counter' => (
246 \& traits => ['Counter'],
251 \& inc_counter => 'inc',
252 \& dec_counter => 'dec',
253 \& reset_counter => 'reset',
259 Common methods for boolean values.
263 \& traits => ['Bool'],
268 \& illuminate => 'set',
269 \& darken => 'unset',
270 \& flip_switch => 'toggle',
277 Common methods for hash references.
280 \& has 'options' => (
281 \& traits => ['Hash'],
283 \& isa => 'HashRef[Str]',
284 \& default => sub { {} },
286 \& set_option => 'set',
287 \& get_option => 'get',
288 \& has_option => 'exists',
294 Common methods for array references.
298 \& traits => ['Array'],
300 \& isa => 'ArrayRef[Str]',
301 \& default => sub { [] },
303 \& add_item => 'push',
304 \& next_item => 'shift',
310 Common methods for code references.
313 \& has 'callback' => (
314 \& traits => ['Code'],
317 \& default => sub { sub { 'called' } },
319 \& call => 'execute',
325 All complex software has bugs lurking in it, and this module is no
326 exception. If you find a bug please either email me, or add the bug
330 Stevan Little <stevan@iinteractive.com>
332 \&\fBwith contributions from:\fR
336 Paul (frodwith) Driver
340 Chris (perigrin) Prather
342 Robert (phaylon) Sedlacek
352 Florian (rafl) Ragwitz
357 .SH "COPYRIGHT AND LICENSE"
358 .IX Header "COPYRIGHT AND LICENSE"
359 Copyright 2007\-2009 by Infinity Interactive, Inc.
361 <http://www.iinteractive.com>
363 This library is free software; you can redistribute it and/or modify
364 it under the same terms as Perl itself.