criswell has asked for the wisdom of the Perl Monks concerning the following question:
Alright, there may be a very simple answer to this question that I have missed, but here goes...
I'm writing a perl script that needs to provide a number of different interfaces (e-mail wrapper, CGI, and command line namely). What I need to know is how the script was run. Was it called as an e-mail wrapper, CGI script, from the command line?
I know that I can check on the existance of certain %ENV keys, but I'm not certain how portable or reliable some of those are. Is $ENV{LOGNAME} only set for e-mail wrappers running under Linux with sendmail? Will that same one exist on SunOS running Postfix? Questions like these trouble me, and I cannot answer them.
Is there a better way than checking %ENV and hoping that these are reliable on 'x' OS with 'y' mail server or 'z' web server? ;-)
(Also, before someone suggests it, I know I can just have the bulk of the code in an external module and then have small script-shells that are specific for each interface. I'm just trying to avoid that because I ultimately don't know what interfaces I will finally choose on using for this particular script)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How was my script ran?
by jsprat (Curate) on Mar 05, 2003 at 01:26 UTC | |
by LAI (Hermit) on Mar 05, 2003 at 15:33 UTC | |
by jsprat (Curate) on Mar 05, 2003 at 17:57 UTC | |
|
Re: How was my script ran?
by criswell (Initiate) on Mar 05, 2003 at 00:45 UTC | |
by jasonk (Parson) on Mar 05, 2003 at 00:55 UTC | |
by criswell (Initiate) on Mar 05, 2003 at 01:04 UTC | |
by Anonymous Monk on Mar 05, 2003 at 02:31 UTC | |
by graff (Chancellor) on Mar 05, 2003 at 05:21 UTC |