Re: associated_class in Moose::Util::MetaRole attribute_metaclass_role not returning consuming class

2009-07-06 Thread Mark Morgan
On Sat, Jul 4, 2009 at 12:41 AM, Hans Dieter Pearcey wrote: > On Sat, Jul 04, 2009 at 12:31:35AM +0100, Mark Morgan wrote: >  package My::Meta::Attribute::Trait::Highlander; >  use Moose::Role; >  before attach_to_class => sub { >    my ($self, $metaclass) = @_; >    my ($existing) = grep { >      

Re: associated_class in Moose::Util::MetaRole attribute_metaclass_role not returning consuming class

2009-07-03 Thread Hans Dieter Pearcey
On Sat, Jul 04, 2009 at 12:31:35AM +0100, Mark Morgan wrote: > In my case, I'm attempting to ensure that only a single attribute is > marked as 'asdf' for a given class. The specified attribute would be > treated specially during constuction package My::Meta::Attribute::Trait::Highlander; use

Re: associated_class in Moose::Util::MetaRole attribute_metaclass_role not returning consuming class

2009-07-03 Thread Stevan Little
Mark, I suspect you want a custom meta-class as well as a custom meta- attribute then. I don't know if you can accomplish this only using the attribute sub-protocol alone. - Stevan On Jul 3, 2009, at 7:31 PM, Mark Morgan wrote: In my case, I'm attempting to ensure that only a single attri

Re: associated_class in Moose::Util::MetaRole attribute_metaclass_role not returning consuming class

2009-07-03 Thread Mark Morgan
In my case, I'm attempting to ensure that only a single attribute is marked as 'asdf' for a given class. The specified attribute would be treated specially during constuction To be more precise, I'm looking at creating a module to allow capturing all arguments that are not defined within init_arg'

Re: associated_class in Moose::Util::MetaRole attribute_metaclass_role not returning consuming class

2009-07-03 Thread Dave Rolsky
On Fri, 3 Jul 2009, Mark Morgan wrote: has asdf => ( is => 'ro', trigger => sub { my ( $self, $value ) = @_; printf( "In trigger, assosciated class = %s\n", $self->associated_class ); }, ); This trigger gets called when the attribute is first crea

associated_class in Moose::Util::MetaRole attribute_metaclass_role not returning consuming class

2009-07-03 Thread Mark Morgan
Heya folks, Sorry in-advance for the long post, but it's the minimal amount of code that I could demonstrate this issue... When creating a new MooseX extension, within a rolled-in attribute, I'm unable to use associated_class method to get the consuming class (well, it succeeds, but returns undef