From: Shawn M Moore Date: Wed, 4 Jun 2008 04:02:35 +0000 (+0000) Subject: Add the attribute to the metaclass before installing the accessors X-Git-Tag: 0.04~100 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b250019157d54598932f9e3e2a82f56c9a8937dd;p=gitmo%2FMouse.git Add the attribute to the metaclass before installing the accessors --- diff --git a/lib/Mouse/Attribute.pm b/lib/Mouse/Attribute.pm index 41a56df..2c8cc5b 100644 --- a/lib/Mouse/Attribute.pm +++ b/lib/Mouse/Attribute.pm @@ -127,6 +127,8 @@ sub create { my $attribute = $self->new(%args, name => $name, class => $class); my $meta = $class->meta; + $meta->add_attribute($attribute); + # install an accessor if ($attribute->{is} eq 'rw' || $attribute->{is} eq 'ro') { my $accessor = $attribute->generate_accessor; @@ -134,8 +136,6 @@ sub create { *{ $class . '::' . $name } = $accessor; } - $meta->add_attribute($attribute); - for my $method (qw/predicate clearer/) { if (exists $attribute->{$method}) { my $generator = "generate_$method";