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 <[email protected]>

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################

Reply via email to