Re: Net::Server - how to hook post_accept



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

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()

For some reason - if i define post_accept_hook - it never gets called!
i just tried it again - and i can't seem to get that thing called.

How come the docs define

sub process_request {
}

and not process_request_hook?

there seems to be an inconsistency?
sub process_request { } works great - and its the same type of hook!

They're not really the same type of hook. The *_hook subs are for doing
additional stuff after the server personality has handled that part of the
request cycle.

process_request is where you plug in your user code to do something useful
once the server has handled all the network stuff - so there isn't a
process_request_hook.

There does seem to be a call to $self->post_accept_hook in
run_client_connection in Net::Server, although I remember seeing a problem in
at least one version of Net::Server where one of the documented hook subs
wasn't called.

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



Relevant Pages