[cgiapp] Windows Environment Setup

Jaldhar H. Vyas jaldhar at braincells.com
Fri Jan 16 14:12:44 EST 2009


On Fri, 16 Jan 2009, Lyle wrote:

> Also if you are using IIS you'll want to start your scripts like:-
>
> #!/Perl/bin/perl.exe
> BEGIN {
>   use FindBin qw ($RealBin $RealScript);
>   use lib $FindBin::RealBin;
>   chdir $RealBin;
>   if ( $ENV{'SERVER_SOFTWARE'} =~ /IIS/ ) {
>       open STDERR, '> iisError.log' || die "Can't write to 
> $RealBin/issError.log: $!\n";
>       binmode STDERR;
>       #close STDERR;
>   }#if
> }#BEGIN
>
> Unlike Linux/Apache, Windows/IIS doesn't execute your Perl scripts with the 
> pwd set to where your script actually is. This can play havoc with Linux code 
> that uses relative paths for files, directories, require, use, etc. This bit 
> of code fixes it.
>
> Also IIS has a habit of sending anything sent to STDERR to STDOUT instead. 
> This can cause some weird problems, so either close STDERR or set it to your 
> own log file instead (as above).
>

You know what?  You should wrap this and any other IIS quirks into a 
CGI::Application::Plugin::IIS and upload it to CPAN.

-- 
Jaldhar H. Vyas <jaldhar at braincells.com>


More information about the cgiapp mailing list