Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Determine ip address/hostname of requesting host

by liverpole (Monsignor)
on Sep 21, 2006 at 19:24 UTC ( [id://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 ...

s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

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
      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".


      s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://574246]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-19 12:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found