[Catalyst-commits] r8271 - in Catalyst-Runtime/5.70/trunk/lib/Catalyst: . DispatchType

rafl at dev.catalyst.perl.org rafl at dev.catalyst.perl.org
Sun Aug 24 20:31:45 BST 2008


Author: rafl
Date: 2008-08-24 20:31:44 +0100 (Sun, 24 Aug 2008)
New Revision: 8271

Modified:
   Catalyst-Runtime/5.70/trunk/lib/Catalyst/Controller.pm
   Catalyst-Runtime/5.70/trunk/lib/Catalyst/DispatchType/Chained.pm
Log:
Move :Chained sugar out of DispatchType::Chained.

Modified: Catalyst-Runtime/5.70/trunk/lib/Catalyst/Controller.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/lib/Catalyst/Controller.pm	2008-08-24 07:01:11 UTC (rev 8270)
+++ Catalyst-Runtime/5.70/trunk/lib/Catalyst/Controller.pm	2008-08-24 19:31:44 UTC (rev 8271)
@@ -279,6 +279,28 @@
 
 sub _parse_LocalRegexp_attr { shift->_parse_LocalRegex_attr(@_); }
 
+sub _parse_Chained_attr {
+    my ($self, $c, $name, $value) = @_;
+
+    if (defined($value) && length($value)) {
+        if ($value eq '.') {
+            $value = '/'.$self->action_namespace($c);
+        } elsif ($value !~ m/^\//) {
+            my $action_ns = $self->action_namespace($c);
+
+            if ($action_ns) {
+                $value = '/'.join('/', $action_ns, $value);
+            } else {
+                $value = '/'.$value; # special case namespace '' (root)
+            }
+        }
+    } else {
+        $value = '/'
+    }
+
+    return Chained => $value;
+}
+
 sub _parse_PathPrefix_attr {
     my $self = shift;
     return PathPart => $self->path_prefix;

Modified: Catalyst-Runtime/5.70/trunk/lib/Catalyst/DispatchType/Chained.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/lib/Catalyst/DispatchType/Chained.pm	2008-08-24 07:01:11 UTC (rev 8270)
+++ Catalyst-Runtime/5.70/trunk/lib/Catalyst/DispatchType/Chained.pm	2008-08-24 19:31:44 UTC (rev 8271)
@@ -221,26 +221,8 @@
         );
     }
 
-    my $parent = $chained_attr[0];
+    my $children = ($self->{children_of}{ $chained_attr[0] } ||= {});
 
-    if (defined($parent) && length($parent)) {
-        if ($parent eq '.') {
-            $parent = '/'.$action->namespace;
-        } elsif ($parent !~ m/^\//) {
-            if ($action->namespace) {
-                $parent = '/'.join('/', $action->namespace, $parent);
-            } else {
-                $parent = '/'.$parent; # special case namespace '' (root)
-            }
-        }
-    } else {
-        $parent = '/'
-    }
-
-    $action->attributes->{Chained} = [ $parent ];
-
-    my $children = ($self->{children_of}{$parent} ||= {});
-
     my @path_part = @{ $action->attributes->{PathPart} || [] };
 
     my $part = $action->name;




More information about the Catalyst-commits mailing list