13 May
2014
13 May
'14
11:52 a.m.
On 14-05-13 02:53 AM, Warren Young wrote:
hook before => sub {
my $url = request->uri; redirect $url if $url =~ s#(?<=.)/$##; };
I’m guessing the only reason you have that lookbehind in there is to prevent the substitution from breaking the top-level ‘/‘ route?
Yup, that's it.
Also, is there anything wrong with using “forward” here instead of “redirect”? I’d rather save the HTTP round-trip and not “correct” the browser, as my app really does not care.
Just switching the redirect for a forward will cause an error. But I think that with a judicious use of 'halt' and munging of the 'response' object, that'd be entirely possible. Joy, `/anick