[dancer-users] passing a variable to a new subroutine route

WK wanradt at gmail.com
Mon Aug 24 20:38:30 BST 2015


2015-08-24 20:36 GMT+03:00 Richard Reina <gatorreina at gmail.com>:

> Thanks again for the reply.  When I try it your way:
>
> redirect "/sport_add/$id";
>
> Dancer attempts to serve up the page /sport_add/105 (105 being an the value
> of $ID) and of course gets an error. Not sure what I am doing wrong.

Did you set up get-route like in my example? It is required to show
actual data from database.

> are you saying that hook before makes the var S_id global? I have tried
> invoking it briefly in other routes and it did not seem to be in scope.

before-hook is run on every request, it is not scoped. In your last
example you use sigil with ($) var-method. Is it intentional? "var" is
is here keyword from Dancer DSL and using sigil here for identifier
gets interpolated, I think.


Wbr,
-- 
Kõike hääd,

Gunnar


More information about the dancer-users mailing list