23 around monkey => sub { 'OW' };
25 has trap => (is => 'ro', default => sub { -1 });
51 around monkey => sub { 'OW' };
53 has trap => (is => 'ro', default => sub { -1 });
93 package Ker::Splattered;
105 package Ker::Splattered2;
109 sub monkey { 'WHAT' }
111 with qw/ Ker Splat2 /;
117 package KerSplattered;
121 sub monkey { 'WHAT' }
129 package KerSplattered2;
133 sub monkey { 'WHAT' }
135 with qw/ KerSplat2 /;
145 has pp => (is => 'rw', moosify => sub {
147 $spec->{documentation} = 'moosify';
157 has vv => (is => 'rw', moosify => [quote_sub(q|
158 $_[0]->{documentation} = 'moosify';
159 |), sub { $_[0]->{documentation} = $_[0]->{documentation}.' foo'; }]);
181 has kk => (is => 'rw', moosify => [sub {
182 $_[0]->{documentation} = 'parent';
189 has '+kk' => (moosify => sub {
191 $spec->{documentation} .= 'child';
195 local $SIG{__WARN__} = sub { fail "warning: $_[0]" };
196 package SplatteredMoose;
198 extends 'Splattered';
204 Ker::Splattered->new,
205 Ker::Splattered2->new,
211 and is($s->punch, 1, 'punch');
213 and is($s->jab, 3, 'jab');
215 and is($s->monkey, 'OW', 'monkey');
217 and is($s->trap, -1, 'trap');
226 can_ok($c, 'has_ker');
227 can_ok($c, 'has_splat');
230 is(Plunker->meta->find_attribute_by_name('pp')->documentation, 'moosify', 'moosify modifies attr specs');
231 is(Planker->meta->find_attribute_by_name('vv')->documentation, 'moosify foo', 'moosify modifies attr specs as array');
233 is( Plonker->meta->find_attribute_by_name('kk')->documentation,
235 'moosify applies for overridden attributes with roles');
238 package MooseAttrTrait;
241 has 'extra_attr' => (is => 'ro');
242 has 'extra_attr_noinit' => (is => 'ro', init_arg => undef);
246 local $SIG{__WARN__} = sub { fail "warning: $_[0]" };
247 package UsingMooseTrait;
252 traits => ['MooseAttrTrait'],
254 extra_attr_noinit => 'two',
258 ok( UsingMooseTrait->meta
259 ->find_attribute_by_name('one')->can('extra_attr'),
260 'trait was properly applied');
261 is( UsingMooseTrait->meta->find_attribute_by_name('one')
264 'trait attributes maintain values');