X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FDispatchType%2FChained.pm;h=1b8219afa4535dc8307d51e6915554de7caefdd0;hp=257f7fb8a2e99aca9f1f3409f095564cfe6b2fa5;hb=ac5c933bdd463558e8d621507a53a7b247a9093e;hpb=be5cb4e4793133bae5f0ae5d269f4be3876b1e27 diff --git a/lib/Catalyst/DispatchType/Chained.pm b/lib/Catalyst/DispatchType/Chained.pm index 257f7fb..1b8219a 100644 --- a/lib/Catalyst/DispatchType/Chained.pm +++ b/lib/Catalyst/DispatchType/Chained.pm @@ -3,8 +3,6 @@ package Catalyst::DispatchType::Chained; use Moose; extends 'Catalyst::DispatchType'; -#use strict; -#use base qw/Catalyst::DispatchType/; use Text::SimpleTable; use Catalyst::ActionChain; use URI; @@ -121,20 +119,21 @@ Calls C to see if a chain matches the C<$path>. sub match { my ( $self, $c, $path ) = @_; - return 0 if @{$c->req->args}; + my $request = $c->request; + return 0 if @{$request->args}; my @parts = split('/', $path); my ($chain, $captures, $parts) = $self->recurse_match($c, '/', \@parts); - push @{$c->req->args}, @$parts if $parts && @$parts; + push @{$request->args}, @$parts if $parts && @$parts; return 0 unless $chain; my $action = Catalyst::ActionChain->from_chain($chain); - $c->req->action("/${action}"); - $c->req->match("/${action}"); - $c->req->captures($captures); + $request->action("/${action}"); + $request->match("/${action}"); + $request->captures($captures); $c->action($action); $c->namespace( $action->namespace ); @@ -199,7 +198,7 @@ sub recurse_match { # No best action currently # OR This one matches with fewer parts left than the current best action, # And therefore is a better match - # OR No parts and this expects 0 + # OR No parts and this expects 0 # The current best action might also be Args(0), # but we couldn't chose between then anyway so we'll take the last seen @@ -326,9 +325,11 @@ sub uri_for_action { return undef if @captures; # fail for too many captures return join('/', '', @parts); - + } +__PACKAGE__->meta->make_immutable; + =head1 USAGE =head2 Introduction @@ -487,7 +488,7 @@ this debugging output: '-----------------------+------------------------------' ... -Here's a more detailed specification of the attributes belonging to +Here's a more detailed specification of the attributes belonging to C<:Chained>: =head2 Attributes