I have simple web application written in perl/Mojolicious and running under hypnotoad.
I need to define some handler for the "spawn" event (emited by Mojo::Server::Prefork).
But i dont know, how to insert this hander definitiion in the code of startup method of Mojolicious application. $self->on("spawn"=>sub {})
doesnt work :( And Dumper($self)
was not helpful at all: there are no $self->server or $server->prefork ...
Tell me please, how to do it.
Thanks!
Although i still dont know how to define handler fired on process "spawn", i can tell that absolutely the same thing can be done by using
As it described in Mojolicious Cookbook (http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Pre-forking):
Hint: As i see in my real application, Mojo::IOLoop->singleton->next_tick and Mojo::IOLoop->next_tick works absolutely identically, so i dont know what is the difference between them.