Re: A trigger called when following a 'has_a' (again)

[prev] [thread] [next] [Date index for 2004/07/23]

From: Peter Pimley
Subject: Re: A trigger called when following a 'has_a' (again)
Date: 09:42 on 23 Jul 2004
Charles Bailey wrote:

> I suspect in your case that the bless_to_subclass() trigger end up 
> being called before the inflator() trigger that's part of the has_a, 
> which happily reblesses the object back into the superclass.

I don't think that's what's happening.  If I put a print into the 
trigger, I can see that it doesn't get called.

> In the meantime, custom inflators aren't subject to this problem, so 
> you can avoid it by saying
>
>  __PACKAGE__->has_a(my_thing => 'superclass',
>                     inflate => \&bless_to_subclass);

Yes, that would work.  I'm just not keen on having to remember to put 
the inflate arguments in whenever I do a 'has_a'.  I know we will forget 
small points like this, so I want to keep any messiness in one small 
location.

But:
I'm lucky in that my superclass has only abstract methods.  I can make 
all these methods just rebless the object into the correct subclass and 
do the same method call again.  In fact, I can generate these methods 
automatically with a little 'eval' trickery ;)

Thanks for your help though Charles, you've been very patient with me.

Peter

(message missing)

Re: A trigger called when following a 'has_a'
Peter Pimley 14:17 on 20 Jul 2004

Re: A trigger called when following a 'has_a'
Charles Bailey 14:42 on 20 Jul 2004

Re: A trigger called when following a 'has_a'
Peter Pimley 14:53 on 20 Jul 2004

Re: A trigger called when following a 'has_a'
Charles Bailey 15:22 on 20 Jul 2004

Re: A trigger called when following a 'has_a'
Charles Bailey 15:30 on 20 Jul 2004

Re: A trigger called when following a 'has_a'
Peter Pimley 15:37 on 20 Jul 2004

Re: A trigger called when following a 'has_a'
Charles Bailey 15:47 on 20 Jul 2004

Re: A trigger called when following a 'has_a'
Peter Pimley 10:32 on 21 Jul 2004

A trigger called when following a 'has_a' (again)
Peter Pimley 13:41 on 22 Jul 2004

Re: A trigger called when following a 'has_a' (again)
Peter Pimley 09:42 on 23 Jul 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52