Re: custom accessor_metaclass override of _inline_store (Moose 1 to 2)

[email protected] (Toby Blake) Wed, 23 Mar 2016 11:25:56 +0000
Newsgroups perl.moose
Message-ID <[email protected]>
> On 23 Mar 2016, at 10:46, Buddy Burden <[email protected]> wrote:
>=20
> Toby,
>=20
>> 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 =3D> ....' for every
>> attribute which uses this trait, i.e.  have a trigger built into an
>> attribute trait, if that makes sense?
>=20
> Well, I once put together an attribute trait that creates default subs (t=
he 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 t=
o 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).
>=20
> Anyway, I hope that discussion has something useful in it, particularly w=
hat I ended up with for my final solution.[2]  I've used that pattern a few=
 times over the past few years.

Thanks Buddy, I'll take a look a proper read-through of the thread and see
what I can do.  It certainly sounds useful.

As to your question, yes the attributes in question already consume the
trait(s) I want to expand.

Cheers
Toby


--=20
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.