> I'm working on a project that has been running as CGI on Netscape and
> IIS. We were told to port to mod_perl on Apache. Now it seems we must
> also run on CGI on IIS and on Apache: three platforms total.
>
> Testing $ENV{'GATEWAY_INTERFACE'} allows us to detect CGI, but
> (correct me if I'm wrong) not whether that CGI is on Apache or IIS.
> What I'd like to know is the "right way" to test, from within a script,
>
> * whether one is running under mod_perl? Currently we're doing
>
> > if($ENV{'GATEWAY_INTERFACE'} =~ /^CGI-Perl\//) {
> > $MOD_PERL = 1;
> > } else {
> > $MOD_PERL = 0;
> > }
>
> * whether one is running under IIS?
>
> Please reply directly to me as well as the list/group (I subscribe the
> digest), and TIA, [EMAIL PROTECTED]
Try:
#!/usr/bin/perl
print "Content-type: text/plain\r\n\r\n";
print join "\n", @INC, "\n";
for (keys %ENV){
print "$_ => $ENV{$_}\n";
}
Based on the results from the above script:
* mod_perl test: do {} if $ENV{MOD_PERL};
* Apache test : do {} if $ENV{SERVER_SOFTWARE} =~ /Apache/;
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:[EMAIL PROTECTED] http://perl.org http://stason.org/TULARC
http://singlesheaven.com http://perlmonth.com http://sourcegarden.org