[Catalyst-commits] r13189 - in
Catalyst-Runtime/5.80/branches/forward-comp-obj: lib
lib/Catalyst t/lib t/lib/TestApp/Controller/Action
edenc at dev.catalyst.perl.org
edenc at dev.catalyst.perl.org
Wed Apr 28 22:31:48 GMT 2010
Author: edenc
Date: 2010-04-28 23:31:48 +0100 (Wed, 28 Apr 2010)
New Revision: 13189
Modified:
Catalyst-Runtime/5.80/branches/forward-comp-obj/lib/Catalyst.pm
Catalyst-Runtime/5.80/branches/forward-comp-obj/lib/Catalyst/Action.pm
Catalyst-Runtime/5.80/branches/forward-comp-obj/lib/Catalyst/Dispatcher.pm
Catalyst-Runtime/5.80/branches/forward-comp-obj/t/lib/TestApp.pm
Catalyst-Runtime/5.80/branches/forward-comp-obj/t/lib/TestApp/Controller/Action/Forward.pm
Log:
$c->forward($object) now works like $c->forward($class) but actually dispatches against the object instead of refetching (potentially rerunning ACCEPT_CONTEXT)
Modified: Catalyst-Runtime/5.80/branches/forward-comp-obj/lib/Catalyst/Action.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/forward-comp-obj/lib/Catalyst/Action.pm 2010-04-28 19:41:04 UTC (rev 13188)
+++ Catalyst-Runtime/5.80/branches/forward-comp-obj/lib/Catalyst/Action.pm 2010-04-28 22:31:48 UTC (rev 13189)
@@ -25,6 +25,7 @@
use namespace::clean -except => 'meta';
has class => (is => 'rw');
+has component => (is => 'rw');
has namespace => (is => 'rw');
has 'reverse' => (is => 'rw');
has attributes => (is => 'rw');
@@ -57,7 +58,7 @@
sub dispatch { # Execute ourselves against a context
my ( $self, $c ) = @_;
- return $c->execute( $self->class, $self );
+ return $c->execute( ($self->component || $self->class), $self );
}
sub execute {
Modified: Catalyst-Runtime/5.80/branches/forward-comp-obj/lib/Catalyst/Dispatcher.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/forward-comp-obj/lib/Catalyst/Dispatcher.pm 2010-04-28 19:41:04 UTC (rev 13188)
+++ Catalyst-Runtime/5.80/branches/forward-comp-obj/lib/Catalyst/Dispatcher.pm 2010-04-28 22:31:48 UTC (rev 13189)
@@ -333,6 +333,7 @@
name => $method,
code => $code,
reverse => "$component_class->$method",
+ component => $component,
class => $component_class,
namespace => Catalyst::Utils::class2prefix(
$component_class, ref($c)->config->{case_sensitive}
Modified: Catalyst-Runtime/5.80/branches/forward-comp-obj/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/forward-comp-obj/lib/Catalyst.pm 2010-04-28 19:41:04 UTC (rev 13188)
+++ Catalyst-Runtime/5.80/branches/forward-comp-obj/lib/Catalyst.pm 2010-04-28 22:31:48 UTC (rev 13189)
@@ -318,7 +318,7 @@
=head2 $c->forward( $action [, \@arguments ] )
-=head2 $c->forward( $class, $method, [, \@arguments ] )
+=head2 $c->forward( $class|$object, $method, [, \@arguments ] )
Forwards processing to another action, by its private name. If you give a
class name but no method, C<process()> is called. You may also optionally
Modified: Catalyst-Runtime/5.80/branches/forward-comp-obj/t/lib/TestApp/Controller/Action/Forward.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/forward-comp-obj/t/lib/TestApp/Controller/Action/Forward.pm 2010-04-28 19:41:04 UTC (rev 13188)
+++ Catalyst-Runtime/5.80/branches/forward-comp-obj/t/lib/TestApp/Controller/Action/Forward.pm 2010-04-28 22:31:48 UTC (rev 13189)
@@ -42,6 +42,11 @@
$c->forward( $c->controller('Action::Forward'), 'three' );
}
+sub footest : Local {
+ my($self, $c) = @_;
+ $c->forward('View::Dummy');
+}
+
sub inheritance : Local {
my ( $self, $c ) = @_;
$c->forward('/action/inheritance/a/b/default');
Modified: Catalyst-Runtime/5.80/branches/forward-comp-obj/t/lib/TestApp.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/forward-comp-obj/t/lib/TestApp.pm 2010-04-28 19:41:04 UTC (rev 13188)
+++ Catalyst-Runtime/5.80/branches/forward-comp-obj/t/lib/TestApp.pm 2010-04-28 22:31:48 UTC (rev 13189)
@@ -3,8 +3,8 @@
use strict;
use Catalyst qw/
Test::MangleDollarUnderScore
- Test::Errors
- Test::Headers
+ Test::Errors
+ Test::Headers
Test::Plugin
Test::Inline
+TestApp::Plugin::FullyQualified
@@ -43,7 +43,7 @@
sub execute {
my $c = shift;
- my $class = ref( $c->component( $_[0] ) ) || $_[0];
+ my $class = ref( $c->component( $_[0] ) ) || ref($_[0]) || $_[0];
my $action = $_[1]->reverse;
my $method;
@@ -75,9 +75,9 @@
# useful info if something crashes during a test
sub finalize_error {
my $c = shift;
-
+
$c->next::method(@_);
-
+
$c->res->status(500);
$c->res->body( 'FATAL ERROR: ' . join( ', ', @{ $c->error } ) );
}
@@ -87,7 +87,7 @@
sub Catalyst::Log::error { }
}
-# Make sure we can load Inline plugins.
+# Make sure we can load Inline plugins.
package Catalyst::Plugin::Test::Inline;
More information about the Catalyst-commits
mailing list