Detecting whether a script was called via CGI or the command line 
Hi,

I have a script which is usually run through CGI, but I want to set it 
up to be executed by a cron job each day too.

Within the script I want to know where it was executed from; CGI or 
command line/cron job. I'm currently checking @ARGV to do this i.e. if 
there is data in @ARGV then it was called from the command line, but 
obviously this means there must be command line arguments and I'm also 
not sure whether there could sometimes be arguments in @ARGV when called 
through CGI?

Is there a better way to check?

TIA

Cheers,
Nigel


-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/


