From: Shawn M Moore Date: Mon, 10 Nov 2008 22:23:30 +0000 (+0000) Subject: Fix the API for set_value; even though we don't need the instance we still have to... X-Git-Tag: 0.07~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0c2f7a7a2507b7497bf7cd37d16daebc05f45559;p=gitmo%2FMooseX-ClassAttribute.git Fix the API for set_value; even though we don't need the instance we still have to accept it --- diff --git a/lib/MooseX/ClassAttribute/Role/Meta/Attribute.pm b/lib/MooseX/ClassAttribute/Role/Meta/Attribute.pm index 70052cb..ee3d344 100644 --- a/lib/MooseX/ClassAttribute/Role/Meta/Attribute.pm +++ b/lib/MooseX/ClassAttribute/Role/Meta/Attribute.pm @@ -56,14 +56,15 @@ around 'detach_from_class' => sub sub _initialize { my $self = shift; + my $class_name = $self->associated_class()->name(); if ( $self->has_default() ) { - $self->set_value( $self->default() ); + $self->set_value( $class_name, $self->default() ); } elsif ( $self->has_builder() ) { - $self->set_value( $self->_call_builder() ); + $self->set_value( $class_name, $self->_call_builder() ); } } @@ -103,8 +104,9 @@ around '_call_builder' => sub around 'set_value' => sub { shift; - my $self = shift; - my $value = shift; + my $self = shift; + my $instance = shift; + my $value = shift; $self->associated_class()->set_class_attribute_value( $self->name() => $value ); };