[Dancer-users] do something after sending response

David Precious davidp at preshweb.co.uk
Thu Aug 11 20:27:46 CEST 2011

On Thursday 11 August 2011 18:17:47 David Precious wrote:
> Another possible alternative would be to fork a new process that will do
> the  stuff in the background, whilst the original process continues
> onwards to send the response back to the client.

For the time being, at least, this is probably the easiest option.

Something like:

    hook after => sub {
        if (fork) {
            # parent - do nothing
        } else {
            # Child - sleep for a while
            sleep 50;

With a quick test, that works as expected.  (The exit is required, so that the 
child process doesn't then go on return control to Dancer.)

David Precious  ("bigpresh")

   "Programming is like sex. One mistake and you have to support
   it for the rest of your life". (Michael Sinz)

More information about the Dancer-users mailing list