[dancer-users] Does dancer have a post-return hook or something of that nature?

John Stoffel john at stoffel.org
Sat Aug 22 21:47:02 BST 2015

>>>>> "Robert" == Robert Smith <spamfree at wansecurity.com> writes:

Robert> Here’s what I want to do:
Robert> post '/info' => sub {
Robert>         info "\n\n\tIn /info with params:\n" . Dumper params;

Robert> 	my $tmp_href = params;

Robert>   	if (&do_some_stuff_here($tmp_href)) {
Robert>                 $tmp_href->{status_code}        = "200";		
Robert> 	}
Robert> 	return $tmp_href;

Robert> 	here, but somehow a callback function for post-return
Robert> 	or something like that?)
Well... you can't do anything in a function after a return gets
called, so you will have to setup a callback function.  What are you
trying to do in the callback?  

Before the return $tmp_ref; you need to put in a call to something
else, which could just be a POST to another URL.  Or if it's a longer
lived process (say you're kicking off a job to process all the params
you passed in), then maybe what you want to do is really return a DIV
and some javascript which will poll looking for updates, etc.

Sorta like how some of the pagination stuff works.  Sorry I'm not
being very specific here, I'd be pounding my head too.  :-)


More information about the dancer-users mailing list