[dancer-users] Dancer1 v1.3124 on its way to CPAN

Warren Young warren at etr-usa.com
Tue May 13 07:53:59 BST 2014


On May 12, 2014, at 7:37 PM, Yanick Champoux <yanick at babyl.dyndns.org> wrote:

> On 14-05-12 01:24 PM, Warren Young wrote:
>> can I ask Dancer to ignore trailing slashes?
> 
> 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?

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.


More information about the dancer-users mailing list