From: Dave Rolsky Date: Thu, 19 Mar 2009 18:48:21 +0000 (-0500) Subject: changes needed to get Moose working with the renames-and-deprecations branch of CMOP X-Git-Tag: 0.73_01~5^2~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6a4a7c310ccaf4300113254461326415f74f93ac;p=gitmo%2FMoose.git changes needed to get Moose working with the renames-and-deprecations branch of CMOP --- diff --git a/lib/Moose/Meta/Class.pm b/lib/Moose/Meta/Class.pm index 6f167af..1993a81 100644 --- a/lib/Moose/Meta/Class.pm +++ b/lib/Moose/Meta/Class.pm @@ -71,14 +71,14 @@ sub create { return $class; } -sub check_metaclass_compatibility { +sub _check_metaclass_compatibility { my $self = shift; if ( my @supers = $self->superclasses ) { $self->_fix_metaclass_incompatibility(@supers); } - $self->SUPER::check_metaclass_compatibility(@_); + $self->SUPER::_check_metaclass_compatibility(@_); } my %ANON_CLASSES; diff --git a/lib/Moose/Meta/Method/Accessor.pm b/lib/Moose/Meta/Method/Accessor.pm index 7da74ee..240309e 100644 --- a/lib/Moose/Meta/Method/Accessor.pm +++ b/lib/Moose/Meta/Method/Accessor.pm @@ -39,7 +39,7 @@ sub _eval_code { or $self->throw_error("Could not create writer for '${\$self->associated_attribute->name}' because $@ \n code: $code", error => $@, data => $code ); } -sub generate_accessor_method_inline { +sub _generate_accessor_method_inline { my $self = $_[0]; my $attr = $self->associated_attribute; my $attr_name = $attr->name; @@ -63,7 +63,7 @@ sub generate_accessor_method_inline { . ' }'); } -sub generate_writer_method_inline { +sub _generate_writer_method_inline { my $self = $_[0]; my $attr = $self->associated_attribute; my $attr_name = $attr->name; @@ -83,7 +83,7 @@ sub generate_writer_method_inline { . ' }'); } -sub generate_reader_method_inline { +sub _generate_reader_method_inline { my $self = $_[0]; my $attr = $self->associated_attribute; my $attr_name = $attr->name; @@ -109,11 +109,11 @@ sub _value_needs_copy { return $attr->should_coerce; } -sub generate_reader_method { shift->generate_reader_method_inline(@_) } -sub generate_writer_method { shift->generate_writer_method_inline(@_) } -sub generate_accessor_method { shift->generate_accessor_method_inline(@_) } -sub generate_predicate_method { shift->generate_predicate_method_inline(@_) } -sub generate_clearer_method { shift->generate_clearer_method_inline(@_) } +sub _generate_reader_method { shift->_generate_reader_method_inline(@_) } +sub _generate_writer_method { shift->_generate_writer_method_inline(@_) } +sub _generate_accessor_method { shift->_generate_accessor_method_inline(@_) } +sub _generate_predicate_method { shift->_generate_predicate_method_inline(@_) } +sub _generate_clearer_method { shift->_generate_clearer_method_inline(@_) } sub _inline_pre_body { '' } sub _inline_post_body { '' } diff --git a/lib/Moose/Meta/Role.pm b/lib/Moose/Meta/Role.pm index f1fd0c7..68d2ed8 100644 --- a/lib/Moose/Meta/Role.pm +++ b/lib/Moose/Meta/Role.pm @@ -490,8 +490,6 @@ sub create { || confess "You must pass a HASH ref of methods" if exists $options{methods}; - $role->SUPER::create(%options); - my (%initialize_options) = %options; delete @initialize_options{qw( package @@ -503,6 +501,8 @@ sub create { my $meta = $role->initialize( $package_name => %initialize_options ); + $meta->_instantiate_module( $options{version}, $options{authority} ); + # FIXME totally lame $meta->add_method('meta' => sub { $role->initialize(ref($_[0]) || $_[0]); diff --git a/t/200_examples/002_example_Moose_POOP.t b/t/200_examples/002_example_Moose_POOP.t index a7e0153..143a46e 100644 --- a/t/200_examples/002_example_Moose_POOP.t +++ b/t/200_examples/002_example_Moose_POOP.t @@ -72,19 +72,20 @@ BEGIN { $db->{$class}->[($oid - 1)] = {}; - $self->bless_instance_structure({ + bless { oid => $oid, instance => $db->{$class}->[($oid - 1)] - }); + }, $class; } sub find_instance { my ($self, $oid) = @_; my $instance = $db->{$self->associated_metaclass->name}->[($oid - 1)]; - $self->bless_instance_structure({ + + bless { oid => $oid, - instance => $instance - }); + instance => $instance, + }, $self->associated_metaclass->name; } sub clone_instance { @@ -95,10 +96,10 @@ BEGIN { my $clone = tied($instance)->clone; - $self->bless_instance_structure({ + bless { oid => $oid, - instance => $clone - }); + instance => $clone, + }, $class; } } diff --git a/t/200_examples/006_example_Protomoose.t b/t/200_examples/006_example_Protomoose.t index 6719e57..123d785 100644 --- a/t/200_examples/006_example_Protomoose.t +++ b/t/200_examples/006_example_Protomoose.t @@ -67,7 +67,7 @@ Well cause merlyn asked if it could :) return $instance; } - sub generate_accessor_method { + sub _generate_accessor_method { my $self = shift; my $attr = $self->associated_attribute; return sub { @@ -81,7 +81,7 @@ Well cause merlyn asked if it could :) }; } - sub generate_reader_method { + sub _generate_reader_method { my $self = shift; my $attr = $self->associated_attribute; return sub { @@ -90,7 +90,7 @@ Well cause merlyn asked if it could :) }; } - sub generate_writer_method { + sub _generate_writer_method { my $self = shift; my $attr = $self->associated_attribute; return sub {