oops, replied to the wrong address

----- Forwarded message from Jesse Luehrs <[email protected]> -----

From: Jesse Luehrs <[email protected]>
Date: Sat, 3 Apr 2010 14:17:38 -0500
To: Dave Rolsky <[email protected]>
Subject: Re: Moose Meta cookbook recipe 5 broken (attribute as metaclass
        trait) broken in Moose 1.01? (fwd)

On Sat, Apr 03, 2010 at 12:47:26PM -0500, Dave Rolsky wrote:
>
> ---------- Forwarded message ----------
> Date: Sat, 3 Apr 2010 08:40:29 -0700
> From: Larry Marso <[email protected]>
> To: [email protected]
> Subject: Moose Meta cookbook recipe 5 broken (attribute as metaclass trait)
>     broken in Moose 1.01?
>
> something about reader/writer methods changing?
>
> fyi, with Moose 1.01, running your recipe 5 from moose meta cookbook I get:
>
>     Can't locate object method "table" via package 
> "Class::MOP::Class::__ANON__::SERIAL::1" at line 15.
>
> code:
>
>     package MyApp::Meta::Class::Trait::HasTable;
>     use Moose::Role;
>
>     has table => (
>         is  => 'rw',
>         isa => 'Str',
>     );
>
>     package Moose::Meta::Class::Custom::Trait::HasTable;
>     sub register_implementation { 'MyApp::Meta::Class::Trait::HasTable' }
>
>     package MyApp::User;
>     use Moose -traits => 'HasTable';
>
>     __PACKAGE__->meta->table('User');

"use Moose -traits => 'HasTable'" is a compile time operation, and at
compile time, the 'has' statement in the role has yet to run. If you put
these in different files (or wrap the role package in a BEGIN block),
this works fine.

-doy

----- End forwarded message -----

Reply via email to