[cgiapp] Windows Environment Setup

Lyle webmaster at cosmicperl.com
Fri Jan 16 13:10:09 EST 2009


fREW Schmidt wrote:
> On Fri, Jan 16, 2009 at 10:29 AM, Lyle <webmaster at cosmicperl.com> wrote:
>   
>> Mike Tonks wrote:
>>     
>>> Hi All,
>>>
>>> I was recently asked how to setup a dev environment on Windows for
>>> CGI::Application, and couldn't answer, other than to install ubuntu as
>>> a dual boot and use that.
>>>
>>> Can anyone suggest ways to do this?
>>>
>>>       
>> You've got a few options. Depends on what windows they have and what they
>> already have setup really.
>>
>> IIS->ActivePerl
>> Apache->ActivePerl
>>
>> I can't say I've used strawberry Perl yet, so can't comment on that option.
>>
>> ppm install CGI::Application
>>
>> Komodo Edit is pretty good, they also offer a trial for the full Komodo
>> http://www.activestate.com
>>
>>     
>
> Also: I would recommend adding the recommended sources to ppm.  Run
> the ppm ui and click Edit->Preferences, go to the repositories tab,
> and then add all of the suggested from the list.  That will give you
> options for plugins and whatnot that you wouldn't have otherwise.
>   

Good point I missed that. 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).


Hope that helps


Lyle



More information about the cgiapp mailing list