[Koha-patches] [PATCH] Small documentation improvement for C4::Service

Jesse Weaver pianohacker at gmail.com
Wed May 27 16:31:29 CEST 2009


---
 C4/Service.pm |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/C4/Service.pm b/C4/Service.pm
index cc156ab..e39334e 100644
--- a/C4/Service.pm
+++ b/C4/Service.pm
@@ -242,9 +242,11 @@ C4::Service->dispatch(
 dispatch takes several array-refs, each one describing a 'route', to use the
 Rails terminology.
 
-$path_regex should be a string in regex-form, describing which paths this route
-handles. Each route is tested in order, from the top down, so put more specific
-handlers first. Also, the regex is tested on the entire path.
+$path_regex should be a string in regex-form, describing which methods and
+paths this route handles. Each route is tested in order, from the top down, so
+put more specific handlers first. Also, the regex is tested on the request
+method, plus the path. For instance, you might use the route [ 'POST /', ... ]
+to handle POST requests to your service.
 
 Each named parameter in @required_params is tested for to make sure the route
 matches, but does not raise an error if one is missing; it simply tests the next
@@ -253,7 +255,7 @@ C<C4::Service->require_params> inside your handler.
 
 \&handler is called with each matched group in $path_regex in its arguments. For
 example, if your service is accessed at the path /blah/123, and you call
-C<dispatch> with the route [ '/blah/(\\d+)', ... ], your handler will be called
+C<dispatch> with the route [ 'GET /blah/(\\d+)', ... ], your handler will be called
 with the argument '123'.
 
 =cut
-- 
1.6.3.1




More information about the Koha-patches mailing list