Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: How was my script launched?

by pc88mxer (Vicar)
on Jul 20, 2008 at 18:48 UTC ( #698927=note: print w/replies, xml ) Need Help??


in reply to How was my script launched?

How about using the -S and -p operators on STDIN?

If your program was invoked by a TCP server (like inetd), then -S STDIN should be true. If it was invoked by a web server then -p STDIN is likely to be true (check this). And if it is taking input from a user then -t STDIN (or perhaps -c STDIN) should be true.

You can also check for environment variables to help decide how you were invoked. For instance, if you are being invoked as a CGI script, the web server will set up a lot of variables that won't be set if you are handling the connection yourself. Same for an interactive session.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://698927]
help
Chatterbox?
[Eily]: I'm programming in python
[Eily]: I think I'm doing something like 3-4 google searches for each line that I write
[Eily]: I feel so efficient :D
[Eily]: (and it's not perl, where one line can do more than one thing at once...)

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (12)
As of 2018-05-22 15:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?