dizzyg has asked for the wisdom of the Perl Monks concerning the following question:
Hi all,
I'd like to be able to call a script via a browser or via the CLI/shell and have that script 'know' what’s calling it. Also, and more importantly, I’d like for the script to be able to pick up arguments of the form option (i.e. like a simple command-line switch) or option=value ; for instance:
In browser via url:
http://.../script.pl?option1&option2&option3=value3
In CLI:
script.pl option1 option2 option3=value3
I've tried this with CGI and @ARGS but the way either handles switches or assignments is inconsistent and I haven't been able to tell programatically what's calling it.
Cheers
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Telling if your script is running from web page or CLI
by Anonymous Monk on Sep 29, 2005 at 14:10 UTC | |
|
Re: Telling if your script is running from web page or CLI
by japhy (Canon) on Sep 29, 2005 at 14:04 UTC | |
by jhourcle (Prior) on Sep 29, 2005 at 14:12 UTC | |
by CountZero (Bishop) on Sep 29, 2005 at 19:46 UTC | |
by jhourcle (Prior) on Sep 30, 2005 at 00:20 UTC | |
by CountZero (Bishop) on Sep 30, 2005 at 18:59 UTC | |
|
Re: Telling if your script is running from web page or CLI
by Zaxo (Archbishop) on Sep 29, 2005 at 23:03 UTC |