[dancer-users] passing a variable to a new subroutine route
WK
wanradt at gmail.com
Mon Aug 24 00:08:34 BST 2015
2015-08-23 22:31 GMT+03:00 Richard Reina <gatorreina at gmail.com>:
> PLEASE IGNORE MY POST SENT MOMENTS AGO. I WAS NOT FINISHED TYPING.
I think, in your previous post you were much closer to the needed pattern.
> post '/mypage' => sub { # let user make a selection
>
> my $select_id = params->{Sselect};
>
> print "\n\nLooks Like They Selected No: $select_id\n\n";
Printing here is not good idea.
> # look up DB records corresponding to $select_id;
>
> # store them in hash refrence $sel_ref
Nope. If you need to store users posted data in DB, you redirect them
afterwards to another route (/sport_add/$sele) and look up from DB
there (get your $self_ref).
If you don't need to store, you don't have need for post-route at all.
And your get-route would look like:
get '/sport_add/:id' => sub {
my ( $id ) = splat;
# DB query by ID
# template call ...
}
Hope it helps a bit
wbr,
--
Kõike hääd,
Gunnar
More information about the dancer-users
mailing list