You could detect OS by use of something like this:-

 if (($^O eq 'MSWin32') or ($^O =~ /cygwin/i)) { ... # works for me

And perhaps context by this:-

 if defined $ENV{GATEWAY_INTERFACE} { ... # untested, in my case "CGI/1.1"
in CGI, else undefined

And there's a variable $^V that gives you your revision etc of Perl.

I guess you could lash them all together somehow...

HTH, rgds, GStC.

 

-----Original Message-----
From: Peter Rabbitson [mailto:[EMAIL PROTECTED] 
Sent: Saturday, March 05, 2005 5:42 PM
To: beginners@perl.org
Subject: Re: Invocation environment detection

What if I want it to be able to run under everything:

* CGI (html output)
* Linux tty (text only output)
* ActivePerl (text only output + some workarounds for braindead OS)

(Sorry, forgot to CC)

--
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/>
<http://learn.perl.org/first-response>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to