[Catalyst-commits] r8277 - Catalyst-Runtime/5.70/trunk/lib/Catalyst
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Sun Aug 24 20:32:27 BST 2008
Author: rafl
Date: 2008-08-24 20:32:27 +0100 (Sun, 24 Aug 2008)
New Revision: 8277
Modified:
Catalyst-Runtime/5.70/trunk/lib/Catalyst/Controller.pm
Log:
Implement relative chaining over more than one level.
Modified: Catalyst-Runtime/5.70/trunk/lib/Catalyst/Controller.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/lib/Catalyst/Controller.pm 2008-08-24 19:32:21 UTC (rev 8276)
+++ Catalyst-Runtime/5.70/trunk/lib/Catalyst/Controller.pm 2008-08-24 19:32:27 UTC (rev 8277)
@@ -285,9 +285,11 @@
if (defined($value) && length($value)) {
if ($value eq '.') {
$value = '/'.$self->action_namespace($c);
- } elsif (my ($rest) = $value =~ /^\.{2}\/(.*)$/) {
+ } elsif (my ($rel, $rest) = $value =~ /^((?:\.{2}\/)+)(.*)$/) {
my @parts = split '/', $self->action_namespace($c);
- $value = '/'.join('/', @parts[0 .. $#parts-1], $rest);
+ my @levels = split '/', $rel;
+
+ $value = '/'.join('/', @parts[0 .. $#parts - @levels], $rest);
} elsif ($value !~ m/^\//) {
my $action_ns = $self->action_namespace($c);
More information about the Catalyst-commits
mailing list