[dancer-users] How to change route in the before hook?

Gabor Szabo gabor at szabgab.com
Thu Oct 24 09:16:54 BST 2013


Using Dancer2 I would like to change the route before the user reaches
the route. (e.g. if the user is not logged in)

https://metacpan.org/pod/Dancer2::Cookbook#Before-filters---processed-before-a-request

seems to suggest forward

hook before => sub {
    forward '/foo/oversee';
};

but that just lead me to deep recursion.

Is this a bug or am I doing something wrong?

My assumption was that after that forward the before hook should not run again.
So maybe I need to rephrase the question? How to change the rout on
the fly and NOT call the before hook again?

regards
   Gabor


More information about the dancer-users mailing list