[Catalyst-commits] r9639 - in Catalyst-Runtime/5.80/branches/register_actions/lib: . Catalyst

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Thu Apr 2 01:40:57 BST 2009


Author: t0m
Date: 2009-04-02 01:40:57 +0100 (Thu, 02 Apr 2009)
New Revision: 9639

Modified:
   Catalyst-Runtime/5.80/branches/register_actions/lib/Catalyst.pm
   Catalyst-Runtime/5.80/branches/register_actions/lib/Catalyst/ClassData.pm
   Catalyst-Runtime/5.80/branches/register_actions/lib/Catalyst/Controller.pm
Log:
And fix it properly.

Modified: Catalyst-Runtime/5.80/branches/register_actions/lib/Catalyst/ClassData.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/register_actions/lib/Catalyst/ClassData.pm	2009-04-02 00:23:26 UTC (rev 9638)
+++ Catalyst-Runtime/5.80/branches/register_actions/lib/Catalyst/ClassData.pm	2009-04-02 00:40:57 UTC (rev 9639)
@@ -2,7 +2,7 @@
 
 use Moose::Role;
 use Class::MOP;
-use Class::MOP::Object;
+use Moose::Util ();
 
 sub mk_classdata {
   my ($class, $attribute) = @_;
@@ -12,8 +12,8 @@
   my $slot = '$'.$attribute;
   my $accessor =  sub {
     my $pkg = ref $_[0] || $_[0];
-    # Hack - delberately create a metaclass instance
-    my $meta = $pkg->Moose::Object::meta();
+    my $meta = Moose::Util::find_meta($pkg) 
+        || Moose->init_meta( for_class => $pkg );
     if (@_ > 1) {
       $meta->namespace->{$attribute} = \$_[1];
       return $_[1];

Modified: Catalyst-Runtime/5.80/branches/register_actions/lib/Catalyst/Controller.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/register_actions/lib/Catalyst/Controller.pm	2009-04-02 00:23:26 UTC (rev 9638)
+++ Catalyst-Runtime/5.80/branches/register_actions/lib/Catalyst/Controller.pm	2009-04-02 00:40:57 UTC (rev 9639)
@@ -181,6 +181,8 @@
     #this is still not correct for some reason.
     my $namespace = $self->action_namespace($c);
     my $meta = find_meta($self);
+    confess("Wrong metaclass $meta for $self - " . $meta->name)
+        unless $meta->can('get_all_methods_with_attributes');
     my @methods = $meta->get_all_methods_with_attributes;
 
     foreach my $method (@methods) {

Modified: Catalyst-Runtime/5.80/branches/register_actions/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/register_actions/lib/Catalyst.pm	2009-04-02 00:23:26 UTC (rev 9638)
+++ Catalyst-Runtime/5.80/branches/register_actions/lib/Catalyst.pm	2009-04-02 00:40:57 UTC (rev 9639)
@@ -2085,6 +2085,8 @@
 sub setup_component {
     my( $class, $component ) = @_;
 
+
+    #warn("Component $component has meta " . $component->meta);
     unless ( $component->can( 'COMPONENT' ) ) {
         return $component;
     }




More information about the Catalyst-commits mailing list