On Friday 17 December 2010 06:31:33 Gurunandan Bhat wrote:
Hi,
Is there a way I can set whether a particular route handler calls before(). I am looking to implement authenticated/unauthenticated routes and would like to execute before() only if the route requires authentication. Any suggestions in doing something like this would be great.
before handlers are called before all requests, but you don't have to do anything if the request isn't one you're interested in. e.g. before sub { return if request->path_info !~ m{^/private/}; # Authentication stuff here }; Is that any use? Of course, that means the list of which routes require authentication is kept separately to the route declarations themselves, which might not be what you want. Cheers Dave P