[Jifty-commit] r1664 - jifty/trunk/lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Jul 24 19:11:41 EDT 2006


Author: audreyt
Date: Mon Jul 24 19:11:40 2006
New Revision: 1664

Modified:
   jifty/trunk/lib/Jifty/Dispatcher.pm

Log:
* Dispatcher: Support tangent($url) as sugar for Jifty->web->tangent(url=>$url).
* Dispatcher: Allow "**" in glob pattern to mean anychar including slash.

Modified: jifty/trunk/lib/Jifty/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Dispatcher.pm	(original)
+++ jifty/trunk/lib/Jifty/Dispatcher.pm	Mon Jul 24 19:11:40 2006
@@ -71,8 +71,8 @@
 directory in a default Jifty application.  They're also the right way
 to enable L<Jifty::LetMe> actions.
 
-You can entirely stop processing with the C<redirect> and C<abort>
-directives, though L</after> rules will still run.
+You can entirely stop processing with the C<redirect>, C<tangent> and
+C<abort> directives, though L</after> rules will still run.
 
 =item on
 
@@ -82,15 +82,15 @@
 templates.
 
 Dispatcher directives are evaluated in order until we get to either a
-C<show>, C<redirect> or an C<abort>.
+C<show>, C<redirect>, C<tangent> or C<abort>.
 
 =item after
 
 L<after> rules let you clean up after rendering your page. Delete your
 cache files, write your transaction logs, whatever.
 
-At this point, it's too late to C<show>, C<redirect> or C<abort> page
-display.
+At this point, it's too late to C<show>, C<redirect>, C<tangent> or C<abort>
+page display.
 
 =back
 
@@ -241,6 +241,10 @@
 
 Redirect to another URI.
 
+=head2 tangent $uri
+
+Take a continuation here, and tangent to another URI.
+
 =head2 plugin
 
 See L</Plugins and rule ordering>, above.
@@ -252,7 +256,7 @@
 
     before on after
 
-    show dispatch abort redirect
+    show dispatch abort redirect tangent
 
     GET POST PUT HEAD DELETE OPTIONS
 
@@ -278,6 +282,7 @@
 sub show (;$@)    { _ret @_ }    # render a page
 sub dispatch ($@) { _ret @_ }    # run dispatch again with another URI
 sub redirect ($@) { _ret @_ }    # web redirect
+sub tangent ($@)  { _ret @_ }    # web tangent
 sub abort (;$@)   { _ret @_ }    # abort request
 sub default ($$@) { _ret @_ }    # set parameter if it's not yet set
 sub set ($$@)     { _ret @_ }    # set parameter
@@ -673,7 +678,7 @@
 
 This method is called by the dispatcher internally. You shouldn't need to.
 
-Redirect the user to the URL provded in the mandatory PATH argument.
+Redirect the user to the URL provided in the mandatory PATH argument.
 
 =cut
 
@@ -683,6 +688,21 @@
     Jifty->web->redirect($path);
 }
 
+=head2 _do_tangent PATH
+
+This method is called by the dispatcher internally. You shouldn't need to.
+
+Take a tangent to the URL provided in the mandatory PATH argument.
+(See L<Jifty::Manual::Continuation> for more about tangents.)
+
+=cut
+
+sub _do_tangent {
+    my ( $self, $path ) = @_;
+    $self->log->debug("Taking a tangent to $path");
+    Jifty->web->tangent(url => $path);
+}
+
 =head2 _do_abort 
 
 This method is called by the dispatcher internally. You shouldn't need to.
@@ -979,6 +999,14 @@
 
 =item *
 
+Two stars (C<**>) can match zero or more characters, including slash:
+
+    /**/bar
+    /foo/**
+    **
+
+=item *
+
 Consecutive C<?> marks are captured together:
 
     /foo???bar      # One capture for ???
@@ -1006,6 +1034,10 @@
         (?= / | \z)  # lookahead for slash or end-of-string
     }{([^/]+)}gx;
     $glob =~ s{
+        # Two stars can match zero or more characters, including slash.
+        \\ \* \\ \*
+    }{(.*)}gx;
+    $glob =~ s{
         # All other stars can match zero or more non-slash character.
         \\ \*
     }{([^/]*)}gx;


More information about the Jifty-commit mailing list