X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP%2FAttribute.pm;h=e605533769d83b6aa30377920ab8524275342e61;hb=221f9302d6fe26d935a292c36ab0124b4a47efbc;hp=6d907eae7abbd6f3e6c71240c5a8fe2adea0a254;hpb=eeff7496b5ad6071d6c8608228182d6f1a324f20;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP/Attribute.pm b/lib/Class/MOP/Attribute.pm index 6d907ea..e605533 100644 --- a/lib/Class/MOP/Attribute.pm +++ b/lib/Class/MOP/Attribute.pm @@ -9,7 +9,7 @@ use Class::MOP::Method::Accessor; use Carp 'confess'; use Scalar::Util 'blessed', 'weaken'; -our $VERSION = '0.83'; +our $VERSION = '0.89'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; @@ -57,6 +57,10 @@ sub new { sub _new { my $class = shift; + + return Class::MOP::Class->initialize($class)->new_object(@_) + if $class ne __PACKAGE__; + my $options = @_ == 1 ? $_[0] : {@_}; bless { @@ -179,7 +183,7 @@ sub init_arg { $_[0]->{'init_arg'} } sub initializer { $_[0]->{'initializer'} } sub definition_context { $_[0]->{'definition_context'} } sub insertion_order { $_[0]->{'insertion_order'} } -sub set_insertion_order { $_[0]->{'insertion_order'} = $_[1] } +sub _set_insertion_order { $_[0]->{'insertion_order'} = $_[1] } # end bootstrapped away method section. # (all methods below here are kept intact) @@ -248,7 +252,9 @@ sub get_write_method_ref { } sub is_default_a_coderef { - ('CODE' eq ref($_[0]->{'default'})) + my ($value) = $_[0]->{'default'}; + return unless ref($value); + return ref($value) eq 'CODE' || (blessed($value) && $value->isa('Class::MOP::Method')); } sub default {