move key-value match spec documentation people/mauke/pod-fixes-cleanup
Lukas Mai [Thu, 26 Sep 2013 14:48:11 +0000 (16:48 +0200)]
... to the "Web::Simple match specifications" section where it belongs.

lib/Web/Simple.pm

index 890a339..146a450 100644 (file)
@@ -238,20 +238,6 @@ somewhere will convert it to something useful.  This allows:
     sub (/user/*) { $self->users->get($_[1]) },
   }
 
-An alternative to using prototypes to declare a match specification for a given
-route is to provide a L<Dancer>-like key-value list:
-
-  sub dispatch_request {
-    my $self = shift;
-    (
-      '.html' => sub { response_filter { $self->render_zoom($_[0]) } },
-      '/user/*' => sub { $self->users->get($_[1]) }<
-    )
-  }
-
-This can be useful in situations where you are generating a dispatch table
-programmatically, where setting a subroutine's protoype is difficult.
-
 to render a user object to HTML, if there is an incoming URL such as:
 
   http://myweb.org/user/111.html
@@ -317,6 +303,24 @@ dispatchers and then hit all added filters or L<Plack::Middleware>.
 
 =head2 Web::Simple match specifications
 
+Even though the following examples all use subroutine prototypes, an
+alternative to declare a match specification for a given route is to provide a
+L<Dancer>-like key-value list:
+
+  sub dispatch_request {
+    my $self = shift;
+    (
+      '.html'         => sub { ... },
+      'GET + /user/*' => sub { ... },
+      ## equivalent to:
+      # sub (.html) { ... },
+      # sub (GET + /user/*) { ... },
+    )
+  }
+
+This can be useful in situations where you are generating a dispatch table
+programmatically, where setting a subroutine's protoype is difficult.
+
 =head3 Method matches
 
   sub (GET) {