[Catalyst-commits] r8012 - in Catalyst-Runtime/5.70/trunk: .
lib/Catalyst t t/lib/TestApp/Controller/Action/Chained
bricas at dev.catalyst.perl.org
bricas at dev.catalyst.perl.org
Fri Jun 27 13:06:54 BST 2008
Author: bricas
Date: 2008-06-27 13:06:54 +0100 (Fri, 27 Jun 2008)
New Revision: 8012
Added:
Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Chained/PathPrefix.pm
Modified:
Catalyst-Runtime/5.70/trunk/Changes
Catalyst-Runtime/5.70/trunk/lib/Catalyst/Controller.pm
Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_chained.t
Log:
rescue :PathPrefix from an old branch
Modified: Catalyst-Runtime/5.70/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.70/trunk/Changes 2008-06-27 09:19:04 UTC (rev 8011)
+++ Catalyst-Runtime/5.70/trunk/Changes 2008-06-27 12:06:54 UTC (rev 8012)
@@ -1,5 +1,8 @@
# This file documents the revision history for Perl extension Catalyst.
+5.7XXXX XXXX
+ - Added PathPrefix attribute
+
5.7099_01 2008-06-25 22:36:00
- Refactored component resolution (component(), models(), model(), et al). We now
throw warnings for two reasons:
Modified: Catalyst-Runtime/5.70/trunk/lib/Catalyst/Controller.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/lib/Catalyst/Controller.pm 2008-06-27 09:19:04 UTC (rev 8011)
+++ Catalyst-Runtime/5.70/trunk/lib/Catalyst/Controller.pm 2008-06-27 12:06:54 UTC (rev 8012)
@@ -279,6 +279,11 @@
sub _parse_LocalRegexp_attr { shift->_parse_LocalRegex_attr(@_); }
+sub _parse_PathPrefix_attr {
+ my $self = shift;
+ return PathPart => $self->path_prefix;
+}
+
sub _parse_ActionClass_attr {
my ( $self, $c, $name, $value ) = @_;
unless ( $value =~ s/^\+// ) {
@@ -346,8 +351,8 @@
=head2 $self->path_prefix($c)
-Returns the default path prefix for :Local, :LocalRegex and relative
-:Path actions in this component. Defaults to the action_namespace or
+Returns the default path prefix for :PathPrefix, :Local, :LocalRegex and
+relative :Path actions in this component. Defaults to the action_namespace or
can be overridden from the "path" config key.
=head2 $self->create_action(%args)
Added: Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Chained/PathPrefix.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Chained/PathPrefix.pm (rev 0)
+++ Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Chained/PathPrefix.pm 2008-06-27 12:06:54 UTC (rev 8012)
@@ -0,0 +1,12 @@
+package TestApp::Controller::Action::Chained::PathPrefix;
+
+use strict;
+use warnings;
+
+use base qw/Catalyst::Controller/;
+
+# this is kinda the same thing as: sub instance : Path {}
+# it should respond to: /action/chained/pathprefix/*
+sub instance : Chained('/') PathPrefix Args(1) { }
+
+1;
Modified: Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_chained.t
===================================================================
--- Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_chained.t 2008-06-27 09:19:04 UTC (rev 8011)
+++ Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_chained.t 2008-06-27 12:06:54 UTC (rev 8012)
@@ -10,7 +10,7 @@
BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-use Test::More tests => 124*$iters;
+use Test::More tests => 127*$iters;
use Catalyst::Test 'TestApp';
if ( $ENV{CAT_BENCHMARK} ) {
@@ -863,4 +863,23 @@
}
+ #
+ # PathPrefix
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::PathPrefix->instance
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/chained/pathprefix/1'),
+ "PathPrefix (as an endpoint)" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; 1', 'Content OK' );
+ }
+
}
More information about the Catalyst-commits
mailing list