Re: Alternative to triggers?

[email protected] (Larry Leszczynski) Sat, 02 Dec 2017 19:45:55 -0700
Newsgroups perl.moose
Message-ID <1512269155.296202.1192054296.3ABFE069@webmail.messagingengine.com>
Thanks for the idea, Jim - I used "after" on the accessors and they do
not get called during the initial object construction.

On Fri, Dec 1, 2017, at 07:23 PM, Jim Bacon wrote:
> Hi, try using an =E2=80=9Caround=E2=80=9D on the accessors. Pretty sure t=
hose are not
> used during construction,
>=20
> Jim
>=20
> > On Dec 1, 2017, at 8:07 PM, Larry Leszczynski <[email protected]> wr=
ote:
> >=20
> > Hi all -
> >=20
> > I have triggers set up on two attributes that check if their values are
> > consistent with each other.  I'm worried that since triggers get called
> > during construction when the values are passed in, it will try to do the
> > check before both of those attributes have been set.  I kinda only want
> > to do the check inside BUILD (at which point I know everything has been
> > set), or later on when one or the other of those attributes changes.
> >=20
> > I know how to call my checking code both from inside BUILD and as a
> > trigger, what I don't know is how to make the trigger *not* fire during
> > the initial construction... which makes me wonder whether there is a
> > different/better way to do it without using triggers.
> >=20
> > For purposes of discussion assume I have an attribute "color" which can
> > be red/blue/green, and another attribute "size" which can be
> > small/medium/large, and that any combination of color and size is ok
> > except I want to croak if you try to use color "red" with size "small".=
=20
> >=20
> >=20
> > Thanks!
> > Larry
>=20