sub handle { my $self = shift->new; while (my $c = $self->accept) { while (my $r = $c->get_request) { ## handle cookie based authentication somewhere in here $self->request($r); $self->SUPER::handle; $c->send_response($self->response) } # replaced ->close, thanks to Sean Meisner # shutdown() doesn't work on AIX. close() is used in this case. Thanks to Jos Clijmans UNIVERSAL::isa($c, 'shutdown') ? $c->shutdown(2) : $c->close(); undef $c; } }