Hi WK, Thank you very much for the reply. Before I saw this came up with this solution to pass the variable to the other sub/template: # take them to the add_sport (but with the id no) hook 'before' => sub { var S_id => $select_id; request->path('/sport_add') }; redirect '/sport_add'; It actually worked but I was wondering if doing it this way with hook and redirect is a bad idea? Also, I was wondering why it's a bad idea to print input from dancer to the console? Does it produce a security vulnerability or is it merely disruptive to dancer? Thanks 2015-08-23 18:08 GMT-05:00 WK <wanradt@gmail.com>:
2015-08-23 22:31 GMT+03:00 Richard Reina <gatorreina@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 _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users