X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FClassData.pm;h=72062d912056284deee4385926d55395c2ef5990;hb=b354201608d428db344c63dd35de096a62a7a9d3;hp=87b68c9952a85454bfb9d91c3ed48c1accb6a261;hpb=76721d3c6f8660effa365b8c1574b1e87f4973cb;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/ClassData.pm b/lib/Catalyst/ClassData.pm index 87b68c9..72062d9 100644 --- a/lib/Catalyst/ClassData.pm +++ b/lib/Catalyst/ClassData.pm @@ -3,7 +3,6 @@ package Catalyst::ClassData; use Moose::Role; use Class::MOP; use Class::MOP::Object; -use Scalar::Util 'blessed'; sub mk_classdata { my ($class, $attribute) = @_; @@ -13,21 +12,10 @@ sub mk_classdata { my $slot = '$'.$attribute; my $accessor = sub { my $pkg = ref $_[0] || $_[0]; + # Hack - delberately create a metaclass instance my $meta = $pkg->Class::MOP::Object::meta(); if (@_ > 1) { $meta->namespace->{$attribute} = \$_[1]; - no strict 'refs'; - if (! *{"${pkg}::${attribute}"}{CODE} ) { - foreach my $super ( $meta->linearized_isa ) { - # If there is a code symbol for this class data in a parent class, but not in our - # class then copy it into our package. This is evil. - my $parent_symbol = *{"${super}::${attribute}"}{CODE} ? \&{"${super}::${attribute}"} : undef; - if (defined $parent_symbol) { - *{"${pkg}::${attribute}"} = $parent_symbol; - last; - } - } - } return $_[1]; } @@ -78,7 +66,7 @@ __END__ =head1 NAME -Catalyst::ClassData - Class data acessors +Catalyst::ClassData - Class data accessors =head1 METHODS