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's.
Ideally, this would be able to ensure at class build time that exactly
one attribute is marked as 'slurpy' for a given class. As it stands
now, I'm only able to ensure this at object instantiation time, which
isn't ideal; better to be able to throw an error when multiple
attributes are marked as slurpy at build time.

Mark.

On Friday, July 3, 2009, Dave Rolsky <auta...@urth.org> wrote:
> 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 created. However, 
> associated_class won't be set until _after_ the attribute has been created 
> and added to a metaclass object, when $attr->attach_to_class($metaclass) is 
> called.
>
> I have no idea what you're trying to do, but I'm sure there's some other way 
> to do it.
>
>
> -dave
>
> /*============================================================
> http://VegGuide.org               http://blog.urth.org
> Your guide to all that's veg      House Absolute(ly Pointless)
> ============================================================*/
>

Reply via email to