[Catalyst-dev] patch for namespace bug introduced in r7385
Peter Karman
peter at peknet.com
Fri May 23 14:40:47 GMT 2008
resending the patch with fix included.
Index: t/live_component_controller_action_forward.t
===================================================================
--- t/live_component_controller_action_forward.t (revision 7765)
+++ t/live_component_controller_action_forward.t (working copy)
@@ -10,7 +10,7 @@
BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-use Test::More tests => 47 * $iters;
+use Test::More tests => 50 * $iters;
use Catalyst::Test 'TestApp';
if ( $ENV{CAT_BENCHMARK} ) {
@@ -234,5 +234,16 @@
is( $response->header('X-Class-Forward-Test-Method'), 1,
'Test Method' );
}
+
+ # test uri_for re r7385
+ {
+ ok( my $response = request(
+ 'http://localhost/action/forward/forward_to_uri_check'),
+ 'forward_to_uri_check request');
+
+ ok( $response->is_success, 'forward_to_uri_check successful');
+ is( $response->content, 'http://localhost/action/forward/foo/bar',
+ 'forward_to_uri_check correct namespace');
+ }
}
Index: t/lib/TestApp/Controller/Action/Forward.pm
===================================================================
--- t/lib/TestApp/Controller/Action/Forward.pm (revision 7765)
+++ t/lib/TestApp/Controller/Action/Forward.pm (working copy)
@@ -85,4 +85,9 @@
$c->forward(qw/TestApp class_forward_test_method/);
}
+sub forward_to_uri_check : Local {
+ my ( $self, $c ) = @_;
+ $c->forward( 'Action::ForwardTo', 'uri_check' );
+}
+
1;
Index: t/lib/TestApp/Controller/Action/ForwardTo.pm
===================================================================
--- t/lib/TestApp/Controller/Action/ForwardTo.pm (revision 0)
+++ t/lib/TestApp/Controller/Action/ForwardTo.pm (revision 0)
@@ -0,0 +1,11 @@
+package TestApp::Controller::Action::ForwardTo;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub uri_check : Private {
+ my ( $self, $c ) = @_;
+ $c->res->body( $c->uri_for('foo/bar') );
+}
+
+1;
Index: lib/Catalyst.pm
===================================================================
--- lib/Catalyst.pm (revision 7765)
+++ lib/Catalyst.pm (working copy)
@@ -34,8 +34,6 @@
qw/counter request response state action stack namespace stats/
);
-attributes->import( __PACKAGE__, \&namespace, 'lvalue' );
-
sub depth { scalar @{ shift->stack || [] }; }
# Laziness++
Index: lib/Catalyst/Action.pm
===================================================================
--- lib/Catalyst/Action.pm (revision 7765)
+++ lib/Catalyst/Action.pm (working copy)
@@ -38,7 +38,6 @@
sub dispatch { # Execute ourselves against a context
my ( $self, $c ) = @_;
- local $c->{namespace} = $self->namespace;
return $c->execute( $self->class, $self );
}
--
Peter Karman . peter at peknet.com . http://peknet.com/
More information about the Catalyst-dev
mailing list