Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

(crazyinsomniac) Re: Outputting to browser vs DOS...how can you tell?

by crazyinsomniac (Prior)
on Mar 31, 2002 at 14:03 UTC ( [id://155601]=note: print w/replies, xml ) Need Help??


in reply to Outputting to browser vs DOS...how can you tell?

zjunior has a pretty good idea about doing it (GATEWAY_INTERFACE will be defined if the script is run through a web-server), but what if some joker sets GATEWAY_INTERFACE to bash in his .bashrc? (stupid I know, but it's been known to happen ;), well from perlfaq8
How do I find out if I'm running interactively or not? Good question. Sometimes -t STDIN and -t STDOUT can give clues, someti +mes not. if (-t STDIN && -t STDOUT) { print "Now what? "; }
-t tells you if a filehandle is tied to a tty. Now I don't know what happens during forking and the like, but the above usually works ;)

 
______crazyinsomniac_____________________________
Of all the things I've lost, I miss my mind the most.
perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

  • Comment on (crazyinsomniac) Re: Outputting to browser vs DOS...how can you tell?
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-26 00:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found