Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

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


Comment on Re: Determine ip address/hostname of requesting host
Download Code
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
Node Status?
node history
Node Type: note [id://574246]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (12)
As of 2014-10-22 12:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (117 votes), past polls