From: Stevan Little Date: Mon, 27 Nov 2006 01:51:54 +0000 (+0000) Subject: fixes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8cbbcb06f0947737b7456f2af2ef2f7f98565bec;p=gitmo%2FClass-MOP.git fixes --- diff --git a/MANIFEST b/MANIFEST index 12aec29..0367ffa 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,7 +1,7 @@ Build.PL Changes -META.yml Makefile.PL +META.yml MANIFEST MANIFEST.SKIP README @@ -17,12 +17,12 @@ lib/metaclass.pm lib/Class/MOP.pm lib/Class/MOP/Attribute.pm lib/Class/MOP/Class.pm +lib/Class/MOP/Immutable.pm lib/Class/MOP/Instance.pm lib/Class/MOP/Method.pm lib/Class/MOP/Module.pm lib/Class/MOP/Object.pm lib/Class/MOP/Package.pm -lib/Class/MOP/Class/Immutable.pm lib/Class/MOP/Method/Accessor.pm lib/Class/MOP/Method/Constructor.pm lib/Class/MOP/Method/Wrapped.pm diff --git a/lib/Class/MOP.pm b/lib/Class/MOP.pm index d741ee2..e2b11bd 100644 --- a/lib/Class/MOP.pm +++ b/lib/Class/MOP.pm @@ -13,7 +13,7 @@ use Class::MOP::Method; use Class::MOP::Immutable; -our $VERSION = '0.36'; +our $VERSION = '0.37_001'; our $AUTHORITY = 'cpan:STEVAN'; { @@ -438,8 +438,11 @@ Class::MOP::Method::Constructor->meta->add_attribute( ); Class::MOP::Method::Constructor->meta->add_attribute( - Class::MOP::Attribute->new('$!metaclass' => ( + Class::MOP::Attribute->new('$!associated_metaclass' => ( init_arg => 'metaclass', + reader => { + 'associated_metaclass' => \&Class::MOP::Method::Constructor::associated_metaclass + }, )) ); diff --git a/lib/Class/MOP/Method/Constructor.pm b/lib/Class/MOP/Method/Constructor.pm index 748c72a..7e389db 100644 --- a/lib/Class/MOP/Method/Constructor.pm +++ b/lib/Class/MOP/Method/Constructor.pm @@ -18,22 +18,23 @@ sub new { (exists $options{options} && ref $options{options} eq 'HASH') || confess "You must pass a hash of options"; - - (blessed $options{metaclass} && $options{metaclass}->isa('Class::MOP::Class')) - || confess "You must pass a metaclass instance"; my $self = bless { # from our superclass '&!body' => undef, # specific to this subclass - '$!metaclass' => $options{metaclass}, - '%!options' => $options{options}, + '%!options' => $options{options}, + '$!meta_instance' => $options{metaclass}->get_meta_instance, + '@!attributes' => [ $options{metaclass}->compute_all_applicable_attributes ], + # ... + '$!associated_metaclass' => $options{metaclass}, } => $class; # we don't want this creating # a cycle in the code, if not # needed - weaken($self->{'$!metaclass'}); +# weaken($self->{'$!meta_instance'}); + weaken($self->{'$!associated_metaclass'}); $self->intialize_body; @@ -50,9 +51,11 @@ sub is_inline { 1 } ## accessors -sub options { (shift)->{'%!options'} } -sub meta_instance { (shift)->{'$!metaclass'}->get_meta_instance } -sub attributes { [ (shift)->{'$!metaclass'}->compute_all_applicable_attributes ] } +sub options { (shift)->{'%!options'} } +sub meta_instance { (shift)->{'$!meta_instance'} } +sub attributes { (shift)->{'@!attributes'} } + +sub associated_metaclass { (shift)->{'$!associated_metaclass'} } ## method @@ -148,6 +151,8 @@ Class::MOP::Method::Constructor - Method Meta Object for constructors =item B +=item B + =item B =item B