Re: MooseX::TrackDirty::Attributes

[email protected] (Chris Weyl)
Newsgroups perl.moose
Message-ID <CABSyATFxECtkftLB37B53RtzBO7+bvkfM8tT1WcLFY-pc7deVw@mail.gmail.com>
On Wed, May 16, 2012 at 4:11 AM, Brian ROONEY
<[email protected]> wrote:
> Is there any way to I can take control of MX::TD::A such that I can decide when to start the dirty tracking?  Specifically, below,  the attributes in Foo::Types::Parameter are populated by reading in a file Foo::Reader->read.  Only after reading in, I then want to trigger the dirty tracking.
>
> Currently the dirty tracking starts after construction of Foo::Types::Parameter which means Foo::Reader::File->param->comment  is immediately dirty  when reading from the file. :(

A couple options come to mind.

* Create a clearer for the attribute, and call it before setting the
value.  (Calling a clearer "resets" the dirty status)

* Make your attribute lazy; this should prevent any value from being
set during construction (assuming no value has been passed to new for
it), so the attribute will not be dirty.

                                -Chris
-- 
Chris Weyl
Ex astris scientia
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.