X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FClassData.pm;h=72062d912056284deee4385926d55395c2ef5990;hb=dfa27f53795d92fb1b4f38dfbc17c6af3bdc4e86;hp=3dde73af36f55da543e11861e94ce61df294b748;hpb=11ae73780599395627cb18dc95849ddcb0fce2ae;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/ClassData.pm b/lib/Catalyst/ClassData.pm index 3dde73a..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,8 +12,9 @@ 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){ + if (@_ > 1) { $meta->namespace->{$attribute} = \$_[1]; return $_[1]; } @@ -29,13 +29,6 @@ sub mk_classdata { return ${$v}; } else { foreach my $super ( $meta->linearized_isa ) { - # If there is a code symbol for this attr in a parent class, - # then copy it into our package. Is this the correct - # fix for C::D::I back-compat? (t0m) - my $parent_symbol = *{"${super}::${attribute}"}{CODE} ? \&{"${super}::${attribute}"} : undef; - if (defined $parent_symbol) { - *{"${pkg}::${attribute}"} = $parent_symbol; - } # tighter version of same after # my $super_meta = Moose::Meta::Class->initialize($super); my $v = ${"${super}::"}{$attribute} ? *{"${super}::${attribute}"}{SCALAR} : undef; @@ -73,7 +66,7 @@ __END__ =head1 NAME -Catalyst::ClassData - Class data acessors +Catalyst::ClassData - Class data accessors =head1 METHODS