First we need to configure our Windows server to run Java Servlet applications. This is easily doable using following instructions.
After installation is completed your server is ready to run Perl applications using either FastCGI or Plack/PSGI protocol. Perl Hosting Package includes Strawberry Perl and some other modules, like CPAN Minus, etc.
For the beginning create a new web site or application in IIS Manager. Either IIS or IIS Express are supported. Let’s name this site “dancer” and folder for it will be “C:\intepub\dancer\”. Now navigate to this folder using command line and run following commands in it:
cpanm -n -L .\perl Dancer
Installation process may take time and after it we will have Dancer compiled and installed with all dependencies in the “C:\intepub\dancer\perl” folder. Local installation is preferable as when you’ll need to deploy your application to the production server your site will have no dependencies, except for Perl Hosting Package from Helicon Zoo.
Now let’s create new Dancer application and call it “mysite”. This is done with the following two commands in the same location:
set PERL5LIB=.\perl\lib\perl5\
perl\bin\dancer.bat -a mysite
After site is created we need to provide write permissions to the “C:\intepub\dancer\mysite\logs\” folder. Dancer requires this permissions to run. Since we already have command line open in the right location, let’s use Windows “icacls” tool for it. Run the following two commands:
md mysite\logs\
icacls mysite\logs\ /t /grant:r "IIS_IUSRS:M"
As the last step we need to create web.config file in the root of the web site – “C:\intepub\dancer\web.config”. Put this code into the web.config file to activate Helicon Zoo for this location:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<heliconZoo>
<application name="dancer">
<environmentVariables>
<add name="APP_WORKER" value="%APPL_VIRTUAL_PATH%mysite\bin\app.pl" />
<add name="PERL5LIB" value="%APPL_PHYSICAL_PATH%\perl\lib\perl5" />
</environmentVariables>
</application>
</heliconZoo>
<handlers>
<add name="dancer#x86" scriptProcessor="perl.5.12.psgi" path="*" verb="*" modules="HeliconZoo_x86"
preCondition="bitness32" resourceType="Unspecified" requireAccess="Script" />
<add name="dancer#x64" scriptProcessor="perl.5.12.psgi" path="*" verb="*" modules="HeliconZoo_x64"
preCondition="bitness64" resourceType="Unspecified" requireAccess="Script" />
</handlers>
</system.webServer>
</configuration>
A little portion of magic and we have it all set. Just point your browser to the web site created and you should see a Dancer welcome page: