[Catalyst-commits] r13282 - in Catalyst-Runtime/5.80/trunk: . lib lib/Catalyst

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Thu May 20 20:34:34 GMT 2010


Author: t0m
Date: 2010-05-20 21:34:34 +0100 (Thu, 20 May 2010)
New Revision: 13282

Modified:
   Catalyst-Runtime/5.80/trunk/Changes
   Catalyst-Runtime/5.80/trunk/Makefile.PL
   Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm
Log:
Changelog and dep bump for more_metaclass_compat branch merge

Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes	2010-05-20 20:31:39 UTC (rev 13281)
+++ Catalyst-Runtime/5.80/trunk/Changes	2010-05-20 20:34:34 UTC (rev 13282)
@@ -1,5 +1,11 @@
 # This file documents the revision history for Perl extension Catalyst.
 
+  Refactoring:
+   - Remove nasty hacks to make classes which are plain old perl work with
+     multiple levels away inherited from Moose classes which do metaclass roles.
+     This issue has been (more correcly) solved in core Moose instead of our
+     workaround.
+
 5.80024 2010-05-15 11:55:44
 
   Bug fixes:

Modified: Catalyst-Runtime/5.80/trunk/Makefile.PL
===================================================================
--- Catalyst-Runtime/5.80/trunk/Makefile.PL	2010-05-20 20:31:39 UTC (rev 13281)
+++ Catalyst-Runtime/5.80/trunk/Makefile.PL	2010-05-20 20:34:34 UTC (rev 13282)
@@ -19,7 +19,7 @@
 requires 'B::Hooks::EndOfScope' => '0.08';
 requires 'MooseX::Emulate::Class::Accessor::Fast' => '0.00903';
 requires 'Class::MOP' => '0.95';
-requires 'Moose' => '1.03';
+requires 'Moose' => '1.05';
 requires 'MooseX::MethodAttributes::Inheritable' => '0.19';
 requires 'MooseX::Role::WithOverloading' => '0.05';
 requires 'Carp';

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm	2010-05-20 20:31:39 UTC (rev 13281)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm	2010-05-20 20:34:34 UTC (rev 13282)
@@ -71,11 +71,14 @@
 
 #I think both of these could be attributes. doesn't really seem like they need
 #to ble class data. i think that attributes +default would work just fine
-__PACKAGE__->mk_classdata($_) for qw/_dispatch_steps _action_class/;
+__PACKAGE__->mk_classdata($_) for qw/_dispatch_steps/;
 
 __PACKAGE__->_dispatch_steps( [qw/_BEGIN _AUTO _ACTION/] );
-__PACKAGE__->_action_class('Catalyst::Action');
 
+has _action_class => (
+    is => 'rw',
+    default => 'Catalyst::Action',
+);
 
 sub _DISPATCH : Private {
     my ( $self, $c ) = @_;
@@ -248,15 +251,22 @@
     }
 }
 
-sub create_action {
-    my $self = shift;
-    my %args = @_;
+sub action_class {
+    my ($self, %args) = @_;
 
     my $class = (exists $args{attributes}{ActionClass}
                     ? $args{attributes}{ActionClass}[0]
                     : $self->_action_class);
     Class::MOP::load_class($class);
+    return $class;
+}
 
+sub create_action {
+    my $self = shift;
+    my %args = @_;
+
+    my $class = $self->action_class(%args);
+
     my $action_args = $self->config->{action_args};
     my %extra_args = (
         %{ $action_args->{'*'}           || {} },

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm	2010-05-20 20:31:39 UTC (rev 13281)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm	2010-05-20 20:34:34 UTC (rev 13282)
@@ -77,8 +77,17 @@
 __PACKAGE__->response_class('Catalyst::Response');
 __PACKAGE__->stats_class('Catalyst::Stats');
 
+# This is here as but we need to be able to call# C::C->action_class, which
+# calls the ->_action_class attribute's accessor to get the default action
+# class for this controller. As the app class is also a controller (eww, warns)
+# but we don't have an instance (just the component name) in the registery,
+# we override _action_class here so that $class->_action_class doesn't explode
+# (so it becomes class data rather than instance data for this one special case).
+# This is a gross back compat hack which can go away for app/ctx split.
+__PACKAGE__->mk_classdata(qw/ _action_class /);
+__PACKAGE__->_action_class('Catalyst::Action');
+
 # Remember to update this in Catalyst::Runtime as well!
-
 our $VERSION = '5.80024';
 
 sub import {
@@ -1154,7 +1163,7 @@
 
     # Add our self to components, since we are also a component
     if( $class->isa('Catalyst::Controller') ){
-      $class->components->{$class} = $class;
+      $class->components->{$class} = $class; # HATEFUL SPECIAL CASE
     }
 
     $class->setup_actions;
@@ -1757,7 +1766,7 @@
     $c->log_response;
 
     if ($c->use_stats) {
-        my $elapsed = sprintf '%f', $c->stats->elapsed;
+        my $elapsed = $c->stats->elapsed;
         my $av = $elapsed == 0 ? '??' : sprintf '%.3f', 1 / $elapsed;
         $c->log->info(
             "Request took ${elapsed}s ($av/s)\n" . $c->stats->report . "\n" );




More information about the Catalyst-commits mailing list