develooper Front page | perl.moose | Postings from March 2016

Re: custom accessor_metaclass override of _inline_store (Moose 1 to2)

Thread Previous | Thread Next
Buddy Burden
March 23, 2016 10:46
Re: custom accessor_metaclass override of _inline_store (Moose 1 to2)
Message ID:

> All these attributes to which I want to apply this trigger share the same
> trait, so there's a logical association between the two.  Is there a way I
> can utilise this, so I don't have to define 'trigger => ....' for every
> attribute which uses this trait, i.e.  have a trigger built into an
> attribute trait, if that makes sense?

Well, I once put together an attribute trait that creates default subs 
(the discussion of which took place on this very list[1]), so I don't 
see any reason you couldn't do the same with triggers.  Of course, then 
the trick is, is adding a trait to every attribute any better than 
adding a trigger to every attribute?  Perhaps you could get around that 
by doing something to the metaclass, or perhaps your attributes 
_already_ all have a trait that you can piggyback on (I wasn't quite 
clear on that part).

Anyway, I hope that discussion has something useful in it, particularly 
what I ended up with for my final solution.[2]  I've used that pattern a 
few times over the past few years.

		-- Buddy


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About