Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Determine ip address/hostname of requesting host

by liverpole (Monsignor)
on Sep 21, 2006 at 19:24 UTC ( #574246=note: print w/replies, xml ) Need Help??

in reply to Determine ip address/hostname of requesting host

Hi davidj, As ikegami recommends, use CGI.

Personally, I like the remote_host() command, (which you can get from reading the CGI documentation):

use strict; use warnings; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); my $ipaddr = remote_host(); # Now log the address $ipaddr ...


Replies are listed 'Best First'.
Re^2: Determine ip address/hostname of requesting host
by blue_cowdawg (Monsignor) on Sep 21, 2006 at 20:52 UTC
        use CGI::Carp qw(fatalsToBrowser);

    One comment: Don't use fatalsToBrowser in a production environment. It could potentially provide an information leak. In production CGI::Carp is going to log to your web server's log files any spew that comes forth. The user just sees something went wrong without knowing what.

    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

          Don't use fatalsToBrowser in a production environment.

      Thanks; that is a good tip.

      To date, all of my own CGI experience has been limited to a local network, where the consumers of my work are mostly other developers, so it's seemed natural to provide as much detail as possible.  But I've had in the back of my mind that it probably isn't what you'd want to do in a larger (ie. visible-to-the-outside) context.

      I'm glad you gave that advice, which I'll remember in case I ever do happen to develop for a "production environment".


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://574246]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2018-03-18 18:39 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (230 votes). Check out past polls.