use Apache2::RequestRec (); use Apache2::Connection (); sub handler { my $r = shift; # the path portion of the URI my $uri = $r->uri(); # the connection object my $c = $r->connection(); # from which we get my $remote_ip = $c->remote_ip(); # whatever }