Skip to content

Commit

Permalink
rework is_dirty to be set during _process_options()
Browse files Browse the repository at this point in the history
...as apparently we cannot rely on $self->name() in is_dirty's builder
anymore??

This doesn't make any sense to me, but... ugh.
  • Loading branch information
rsrchboy committed Dec 23, 2014
1 parent 20ec8f1 commit 151cf69
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/MooseX/TrackDirty/Attributes/Trait/Attribute.pm
Expand Up @@ -26,11 +26,20 @@ Moose::Util::MetaRole::apply_metaroles(
# debugging
#use Smart::Comments '###', '####';

has is_dirty => (is => 'ro', isa => Identifier, predicate => 1, builder => 1);
has is_dirty => (is => 'ro', isa => Identifier, predicate => 1);
has original_value => (is => 'ro', isa => Identifier, predicate => 1);
has cleaner => (is => 'ro', isa => Identifier, predicate => 1);

sub _build_is_dirty { shift->name . '_is_dirty' }
# ensure that our is_dirty option is correct, as we apparently cannot rely on
# $self->name anymore. *le sigh*
after _process_options => sub {
my ($class, $name, $options) = @_;

$options->{is_dirty} = $name . '_is_dirty'
unless defined $options->{is_dirty};

return;
};

has value_slot => (is => 'lazy', isa => 'Str');
has dirty_slot => (is => 'lazy', isa => 'Str');
Expand Down

0 comments on commit 151cf69

Please sign in to comment.