[Catalyst-commits] r8531 - in Catalyst-Runtime/5.70/trunk: . lib
lib/Catalyst t
matthewt at dev.catalyst.perl.org
matthewt at dev.catalyst.perl.org
Wed Oct 15 20:17:30 BST 2008
Author: matthewt
Date: 2008-10-15 20:17:30 +0100 (Wed, 15 Oct 2008)
New Revision: 8531
Removed:
Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_go.t
Modified:
Catalyst-Runtime/5.70/trunk/Changes
Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm
Catalyst-Runtime/5.70/trunk/lib/Catalyst/Dispatcher.pm
Log:
back out go() so we can ship a 5.7100 with other features and bugfixes
Modified: Catalyst-Runtime/5.70/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.70/trunk/Changes 2008-10-15 00:44:55 UTC (rev 8530)
+++ Catalyst-Runtime/5.70/trunk/Changes 2008-10-15 19:17:30 UTC (rev 8531)
@@ -1,6 +1,7 @@
# This file documents the revision history for Perl extension Catalyst.
5.7XXXXXX XXXX
+ - Back out go() since that feature's been pushed to 5.80
- Fix some Win32 test failures
- Add pt translation of error message (wreis)
- Make :Chained('../action') work (Florian Ragwitz)
Modified: Catalyst-Runtime/5.70/trunk/lib/Catalyst/Dispatcher.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/lib/Catalyst/Dispatcher.pm 2008-10-15 00:44:55 UTC (rev 8530)
+++ Catalyst-Runtime/5.70/trunk/lib/Catalyst/Dispatcher.pm 2008-10-15 19:17:30 UTC (rev 8531)
@@ -165,34 +165,6 @@
return $action, \@args;
}
-=head2 $self->go( $c, $command [, \@arguments ] )
-
-Documented in L<Catalyst>
-
-=cut
-
-sub go {
- my $self = shift;
- my ( $c, $command ) = @_;
- my ( $action, $args ) = $self->_command2action(@_);
-
- unless ($action && defined $action->namespace) {
- my $error =
- qq/Couldn't go to command "$command": /
- . qq/Invalid action or component./;
- $c->error($error);
- $c->log->debug($error) if $c->debug;
- return 0;
- }
-
- local $c->request->{arguments} = $args;
- $c->namespace($action->namespace);
- $c->action($action);
- $self->dispatch($c);
-
- die $Catalyst::GO;
-}
-
=head2 $self->forward( $c, $command [, \@arguments ] )
Documented in L<Catalyst>
Modified: Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm 2008-10-15 00:44:55 UTC (rev 8530)
+++ Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm 2008-10-15 19:17:30 UTC (rev 8531)
@@ -49,7 +49,6 @@
our $START = time;
our $RECURSION = 1000;
our $DETACH = "catalyst_detach\n";
-our $GO = "catalyst_go\n";
__PACKAGE__->mk_classdata($_)
for qw/components arguments dispatcher engine log dispatcher_class
@@ -328,20 +327,6 @@
sub detach { my $c = shift; $c->dispatcher->detach( $c, @_ ) }
-=head2 $c->go( $action [, \@arguments ] )
-
-=head2 $c->go( $class, $method, [, \@arguments ] )
-
-Almost the same as C<detach>, but does a full dispatch, instead of just
-calling the new C<$action> / C<$class-E<gt>$method>. This means that C<begin>,
-C<auto> and the method you go to is called, just like a new request.
-
-C<$c-E<gt>stash> is kept unchanged.
-
-=cut
-
-sub go { my $c = shift; $c->dispatcher->go( $c, @_ ) }
-
=head2 $c->response
=head2 $c->res
@@ -1339,9 +1324,6 @@
if ( !ref($error) and $error eq $DETACH ) {
die $DETACH if($c->depth > 1);
}
- elsif ( !ref($error) and $error eq $GO ) {
- die $GO if($c->depth > 0);
- }
else {
unless ( ref $error ) {
no warnings 'uninitialized';
Deleted: Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_go.t
===================================================================
--- Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_go.t 2008-10-15 00:44:55 UTC (rev 8530)
+++ Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_go.t 2008-10-15 19:17:30 UTC (rev 8531)
@@ -1,254 +0,0 @@
-#!perl
-
-use strict;
-use warnings;
-
-use FindBin;
-use lib "$FindBin::Bin/lib";
-
-our $iters;
-
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-
-use Test::More tests => 50 * $iters;
-use Catalyst::Test 'TestApp';
-
-if ( $ENV{CAT_BENCHMARK} ) {
- require Benchmark;
- Benchmark::timethis( $iters, \&run_tests );
-}
-else {
- for ( 1 .. $iters ) {
- run_tests();
- }
-}
-
-sub run_tests {
- {
- # Test go to global private action
- ok( my $response = request('http://localhost/action/go/global'),
- 'Request' );
- ok( $response->is_success, 'Response Successful 2xx' );
- is( $response->content_type, 'text/plain', 'Response Content-Type' );
- is( $response->header('X-Catalyst-Action'),
- 'action/go/global', 'Main Class Action' );
- }
-
- {
- my @expected = qw[
- TestApp::Controller::Action::Go->one
- TestApp::Controller::Action::Go->two
- TestApp::Controller::Action::Go->three
- TestApp::Controller::Action::Go->four
- TestApp::Controller::Action::Go->five
- TestApp::View::Dump::Request->process
- TestApp->end
- ];
-
- @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
- my $expected = join( ", ", @expected );
-
- # Test go to chain of actions.
- ok( my $response = request('http://localhost/action/go/one'),
- 'Request' );
- ok( $response->is_success, 'Response Successful 2xx' );
- is( $response->content_type, 'text/plain', 'Response Content-Type' );
- is( $response->header('X-Catalyst-Action'),
- 'action/go/one', 'Test Action' );
- is(
- $response->header('X-Test-Class'),
- 'TestApp::Controller::Action::Go',
- 'Test Class'
- );
- is( $response->header('X-Catalyst-Executed'),
- $expected, 'Executed actions' );
- like(
- $response->content,
- qr/^bless\( .* 'Catalyst::Request' \)$/s,
- 'Content is a serialized Catalyst::Request'
- );
- }
-
- {
- my @expected = qw[
- TestApp::Controller::Action::Go->go_die
- TestApp::Controller::Action::Go->args
- TestApp->end
- ];
-
- @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
- my $expected = join( ", ", @expected );
-
- ok( my $response = request('http://localhost/action/go/go_die'),
- 'Request' );
- ok( $response->is_success, 'Response Successful 2xx' );
- is( $response->content_type, 'text/plain', 'Response Content-Type' );
- is( $response->header('X-Catalyst-Action'),
- 'action/go/go_die', 'Test Action'
- );
- is(
- $response->header('X-Test-Class'),
- 'TestApp::Controller::Action::Go',
- 'Test Class'
- );
- is( $response->header('X-Catalyst-Executed'),
- $expected, 'Executed actions' );
- is( $response->content, $Catalyst::GO, "Go died as expected" );
- }
-
- {
- ok(
- my $response =
- request('http://localhost/action/go/with_args/old'),
- 'Request with args'
- );
- ok( $response->is_success, 'Response Successful 2xx' );
- is( $response->content, 'old' );
- }
-
- {
- ok(
- my $response = request(
- 'http://localhost/action/go/with_method_and_args/new'),
- 'Request with args and method'
- );
- ok( $response->is_success, 'Response Successful 2xx' );
- is( $response->content, 'new' );
- }
-
- # test go with embedded args
- {
- ok(
- my $response =
- request('http://localhost/action/go/args_embed_relative'),
- 'Request'
- );
- ok( $response->is_success, 'Response Successful 2xx' );
- is( $response->content, 'ok' );
- }
-
- {
- ok(
- my $response =
- request('http://localhost/action/go/args_embed_absolute'),
- 'Request'
- );
- ok( $response->is_success, 'Response Successful 2xx' );
- is( $response->content, 'ok' );
- }
- {
- my @expected = qw[
- TestApp::Controller::Action::TestRelative->relative_go
- TestApp::Controller::Action::Go->one
- TestApp::Controller::Action::Go->two
- TestApp::Controller::Action::Go->three
- TestApp::Controller::Action::Go->four
- TestApp::Controller::Action::Go->five
- TestApp::View::Dump::Request->process
- TestApp->end
- ];
-
- @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
- my $expected = join( ", ", @expected );
-
- # Test go to chain of actions.
- ok( my $response = request('http://localhost/action/relative/relative_go'),
- 'Request' );
- ok( $response->is_success, 'Response Successful 2xx' );
- is( $response->content_type, 'text/plain', 'Response Content-Type' );
- is( $response->header('X-Catalyst-Action'),
- 'action/relative/relative_go', 'Test Action' );
- is(
- $response->header('X-Test-Class'),
- 'TestApp::Controller::Action::Go',
- 'Test Class'
- );
- is( $response->header('X-Catalyst-Executed'),
- $expected, 'Executed actions' );
- like(
- $response->content,
- qr/^bless\( .* 'Catalyst::Request' \)$/s,
- 'Content is a serialized Catalyst::Request'
- );
- }
- {
- my @expected = qw[
- TestApp::Controller::Action::TestRelative->relative_go_two
- TestApp::Controller::Action::Go->one
- TestApp::Controller::Action::Go->two
- TestApp::Controller::Action::Go->three
- TestApp::Controller::Action::Go->four
- TestApp::Controller::Action::Go->five
- TestApp::View::Dump::Request->process
- TestApp->end
- ];
-
- @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
- my $expected = join( ", ", @expected );
-
- # Test go to chain of actions.
- ok(
- my $response =
- request('http://localhost/action/relative/relative_go_two'),
- 'Request'
- );
- ok( $response->is_success, 'Response Successful 2xx' );
- is( $response->content_type, 'text/plain', 'Response Content-Type' );
- is(
- $response->header('X-Catalyst-Action'),
- 'action/relative/relative_go_two',
- 'Test Action'
- );
- is(
- $response->header('X-Test-Class'),
- 'TestApp::Controller::Action::Go',
- 'Test Class'
- );
- is( $response->header('X-Catalyst-Executed'),
- $expected, 'Executed actions' );
- like(
- $response->content,
- qr/^bless\( .* 'Catalyst::Request' \)$/s,
- 'Content is a serialized Catalyst::Request'
- );
- }
-
- # test class go -- MUST FAIL!
- {
- ok(
- my $response = request(
- 'http://localhost/action/go/class_go_test_action'),
- 'Request'
- );
- ok( !$response->is_success, 'Response Fails' );
- is( $response->content, q(FATAL ERROR: Couldn't go to command "TestApp": Invalid action or component.), 'Error message' );
- }
-
- {
- my @expected = qw[
- TestApp::Controller::Action::Go->begin
- TestApp::Controller::Action::Go->go_chained
- TestApp::Controller::Action::Chained->begin
- TestApp::Controller::Action::Chained->foo
- TestApp::Controller::Action::Chained::Foo->spoon
- TestApp::Controller::Action::Chained->end
- ];
-
- my $expected = join( ", ", @expected );
-
- ok( my $response = request('http://localhost/action/go/go_chained'), 'go to chained + subcontroller endpoint' );
- is( $response->header('X-Catalyst-Executed'),
- $expected, 'Executed actions' );
- is( $response->content, '; 1', 'Content OK' );
- }
-
-}
-
-
-
-sub _begin {
- local $_ = shift;
- s/->(.*)$/->begin/;
- return $_;
-}
-
More information about the Catalyst-commits
mailing list