24 around monkey => sub { 'OW' };
26 has trap => (is => 'ro', default => sub { -1 });
52 around monkey => sub { 'OW' };
54 has trap => (is => 'ro', default => sub { -1 });
94 package Ker::Splattered;
100 with qw/ Ker Splat /;
106 package Ker::Splattered2;
110 sub monkey { 'WHAT' }
112 with qw/ Ker Splat2 /;
118 package KerSplattered;
122 sub monkey { 'WHAT' }
130 package KerSplattered2;
134 sub monkey { 'WHAT' }
136 with qw/ KerSplat2 /;
146 has pp => (is => 'rw', moosify => sub {
148 $spec->{documentation} = 'moosify';
158 has vv => (is => 'rw', moosify => [quote_sub(q|
159 $_[0]->{documentation} = 'moosify';
160 |), sub { $_[0]->{documentation} = $_[0]->{documentation}.' foo'; }]);
182 has kk => (is => 'rw', moosify => [sub {
183 $_[0]->{documentation} = 'parent';
190 has '+kk' => (moosify => sub {
192 $spec->{documentation} .= 'child';
196 local $SIG{__WARN__} = sub { fail "warning: $_[0]" };
197 package SplatteredMoose;
199 extends 'Splattered';
205 Ker::Splattered->new,
206 Ker::Splattered2->new,
212 and is($s->punch, 1, 'punch');
214 and is($s->jab, 3, 'jab');
216 and is($s->monkey, 'OW', 'monkey');
218 and is($s->trap, -1, 'trap');
227 can_ok($c, 'has_ker');
228 can_ok($c, 'has_splat');
231 is(Plunker->meta->find_attribute_by_name('pp')->documentation, 'moosify', 'moosify modifies attr specs');
232 is(Planker->meta->find_attribute_by_name('vv')->documentation, 'moosify foo', 'moosify modifies attr specs as array');
234 is( Plonker->meta->find_attribute_by_name('kk')->documentation,
236 'moosify applies for overridden attributes with roles');
239 package MooseAttrTrait;
242 has 'extra_attr' => (is => 'ro');
243 has 'extra_attr_noinit' => (is => 'ro', init_arg => undef);
247 local $SIG{__WARN__} = sub { fail "warning: $_[0]" };
248 package UsingMooseTrait;
253 traits => ['MooseAttrTrait'],
255 extra_attr_noinit => 'two',
259 ok( UsingMooseTrait->meta
260 ->find_attribute_by_name('one')->can('extra_attr'),
261 'trait was properly applied');
262 is( UsingMooseTrait->meta->find_attribute_by_name('one')
265 'trait attributes maintain values');
279 with qw(Splat NeedTrap);
280 }, undef, 'requires satisfied by Moose attribute composed at the same time';