NAME

MooseX::TrackDirty::Attributes - Track dirtied attributes

VERSION

Version 0.01

SYNOPSIS

use Moose;
use MooseX::TrackDirty::Attributes;

# one_is_dirty() is generated w/lazy_build
has one => (is => 'rw', lazy_build => 1);

# dirtyness "accessor" is generated as two_isnt_clean()
has two => (is => 'rw', default => 'foo', dirty => 'two_isnt_clean');

# we do not track three's cleanliness
has three => (is => 'rw', default => 'foo', track_dirty => 0);

# ...etc

WARNING!

This module should be considered alpha at the moment. I'm still trying to figure out the best way to do this -- in particular, tracking attribute status with a hardcoded base class role feels, well, dirty... It seems like I should be able to use MooseX::Role::Parameterized to make this a touch more flexible.

I'll try to preserve this modules behaviour, but no promises at the moment.

DESCRIPTION

MooseX::TrackDirty::Attributes does the necessary metaclass fiddling to track if attributes are dirty; that is, if they're set to some value not from a builder, default, or construction. An attribute can be returned to a clean state by invoking its clearer.

CAVEAT

We don't yet trigger a cascade clear on a master attribute's value being set through a setter/accessor accessor. This will likely be available as an option in the not-too-distant-future.

ATTRIBUTE OPTIONS

We install an attribute metaclass trait that provides two additional atttribute options, as well as wraps the generated clearer and writer/accessor methods of the attribute. By default, use'ing this module causes this trait to be installed for all attributes defined in the package.

track_dirty => (0|1)

If true (the default), we track this attrbutes dirtiness and wrap any generated clearer, setter or accessor methods.

dirty => Str

If set, create a "dirtiness accessor". Default is to not create one. If lazy_build is specified, a method is generated with "foo_is_dirty", where foo is the attribute name.

AUTHOR

Chris Weyl, <cweyl at alumni.drew.edu>

BUGS

Please report any bugs or feature requests to bug-moosex-trackdirty-attributes at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-TrackDirty::Attributes. I will be notified, and then you'llautomatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc MooseX::TrackDirty::Attributes

You can also look for information at:

COPYRIGHT & LICENSE

Copyright (c) 2009, Chris Weyl <cweyl@alumni.drew.edu>.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS OR A PARTICULAR PURPOSE.

See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the

Free Software Foundation, Inc., 
59 Temple Place, Suite 330, 
Boston, MA  02111-1307 USA