From 3206d0fe3c72114c9f3ffed315c5728e3f89ee8f Mon Sep 17 00:00:00 2001 From: Jesse Weaver Date: Wed, 27 May 2009 08:31:29 -0600 Subject: [PATCH] Small documentation improvement for C4::Service Signed-off-by: Galen Charlton --- C4/Service.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/C4/Service.pm b/C4/Service.pm index cc156ab2d1..e39334ea18 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 @@ Crequire_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 with the route [ '/blah/(\\d+)', ... ], your handler will be called +C with the route [ 'GET /blah/(\\d+)', ... ], your handler will be called with the argument '123'. =cut -- 2.39.5