The stuff below should work , or at least give you an idea.
// Jonathan Vanasco
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
package PrintIp;
use mod_perl2 ();
use Apache2::Const qw(:common);
use Apache2::Request ();
use Apache2::RequestRec ();
sub handler {
my $r= shift;
my $apr= Apache2::Request->new( $r );
my $pageUser= PageUser->new( $r , $apr );
$r->content_type('text/html');
$r->print( $pageUser->get_ip() );
return Apache2::Const::OK;
}
package PageUser;
use Apache2::Request ();
use Apache2::Connection ();
sub new {
my $proto= $_[0];
my $class= ref($proto) || $proto;
my $self= bless( {} , $class);
$self->{'ApacheRequestRec'}= $_[1];
$self->{'ApacheRequest'}= $_[2];
return $self;
}
sub get_ip {
my ( $self )= @_;
my $connection= $self->{'ApacheRequest'}->connection;
return $connection->remote_ip();
}