From: Dave Rolsky Date: Tue, 22 Feb 2011 23:38:30 +0000 (-0600) Subject: Simplify attach & detach code X-Git-Tag: v0.24~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=549cbfd22f1c2cbf334e9fbb808526d7ecfd166e;p=gitmo%2FMooseX-ClassAttribute.git Simplify attach & detach code --- diff --git a/lib/MooseX/ClassAttribute/Trait/Attribute.pm b/lib/MooseX/ClassAttribute/Trait/Attribute.pm index 4d3f80d..966eb08 100644 --- a/lib/MooseX/ClassAttribute/Trait/Attribute.pm +++ b/lib/MooseX/ClassAttribute/Trait/Attribute.pm @@ -22,25 +22,19 @@ around _process_options => sub { return $class->$orig( $name, $options ); }; -around attach_to_class => sub { - my $orig = shift; +after attach_to_class => sub { my $self = shift; my $meta = shift; - $self->$orig($meta); - $self->_initialize($meta) unless $self->is_lazy(); }; -around detach_from_class => sub { - my $orig = shift; +before detach_from_class => sub { my $self = shift; my $meta = shift; $self->clear_value($meta); - - $self->$orig($meta); }; sub _initialize {