Re: Net::Server - how to hook post_accept



On 20 Aug 2006 15:27:38 -0700, "shutterstock" <jon@xxxxxxxxxxxxxxxx> wrote:

I'm using Net::Server with the PreFork personality - and I'm trying to
hook post_accept. I would like have my proc called each time there is a
new connection.

What is the way to do this? The documentation doesn't provide it - and
I can't seem to find the answer online..

I tried to do a

sub post_accept {
<<do what i need each time i get a new cnx>>
}

but it seems to break the flow - and lock up the connection.. nothing
else gets handled (process_request never gets called, etc.) if I define
this sub. If I don't include the post_accept proc, my process_request
gets called just fine... How come I can hook process_request without
breaking the flow, but not post_accept?

How do I get the callback/hook whenever a new connection appears?

Define a sub post_accept_hook, rather than overriding post_accept in your
subclass.

http://search.cpan.org/~rhandom/Net-Server-0.94/lib/Net/Server.pm
"
$self->post_accept_hook()

This hook occurs after a client has connected to the server. At this point
STDIN and STDOUT are mapped to the client socket. This hook occurs before the
processing of the request.
"

--
Andy Hassall :: andy@xxxxxxxxxxx :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
.



Relevant Pages