in reply to Re: Moose: Adding methods to a class via attribute traits
in thread Moose: Adding methods to a class via attribute traits
The idea to look there didn't occur to me, so I looked in that source. Sadly I did not find any reference to using a method modifier on 'install_accessors' (which is really a method in Moose::Meta::Atribute).
When I blindly replace my BUILD definition with your method modifier idea, I get:
The method 'install_accessors' was not found in the inheritance hierar +chy for Me at /usr/local/lib/perl5/site_perl/5.10.1/mach/Class/MOP/Cl +ass.pm line 659 Class::MOP::Class::__ANON__('Moose::Meta::Class=HASH(0x8025684c8)' +, 'install_accessors') called at /usr/local/lib/perl5/site_perl/5.10. +1/mach/Class/MOP/Class.pm line 694 Class::MOP::Class::add_after_method_modifier('Moose::Meta::Class=H +ASH(0x8025684c8)', 'install_accessors', 'CODE(0x802568d98)') called a +t /usr/local/lib/perl5/site_perl/5.10.1/mach/Moose/Util.pm line 229 Moose::Util::add_method_modifier('Moose::Meta::Class=HASH(0x802568 +4c8)', 'after', 'ARRAY(0x802443288)') called at /usr/local/lib/perl5/ +site_perl/5.10.1/mach/Moose.pm line 77 Moose::after(undef, 'install_accessors') called at /usr/local/lib/ +perl5/site_perl/5.10.1/mach/Moose/Exporter.pm line 293 Moose::after('install_accessors', 'CODE(0x802568d98)') called at . +/testm line 41
This makes some sense because my class uses Moose, doesnt use an 'extends' keyword, and isn't necessarily a subclass of Moose::Meta::Attribute. Obviously I'm missing something here, but what?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Moose: Adding methods to a class via attribute traits
by Nasrudin (Acolyte) on Jan 17, 2012 at 21:56 UTC |