Contents
Perl Dancer
Installation
1. Open Web Platform Installer and install "Perl project":
2. Open project's home page and follow steps in "Dancer" section:
3. Create app.pl file in the root of IIS web site with following content:
use Dancer;
get '/' => sub {
return 'Hello from Dancer!';
};
start;
Output of example Dancer application:
Deployment
To deploy Dancer application you will need to install Perl Hosting Package on a target server. Then just copy IIS web site from one machine to another.
web.config example
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<heliconZoo>
<application name="perl.project" >
<environmentVariables>
<!-- Use this APP_WORKER with PSGI engine -->
<add name="APP_WORKER" value="app.pl" />
<!--
Deploy file includes the most common commands required to prepare application before launch (bundle install, migrations etc.)
-->
<add name="DEPLOY_FILE" value="deploy.pl" />
<!-- security rules for console are placed in /console/web.config -->
<add name="CONSOLE_URL" value="console" />
<add name="PROXYPASS" value="%APPL_VIRTUAL_PATH%" />
</environmentVariables>
</application>
</heliconZoo>
<handlers>
<!-- All transports below support any Psgi-based application. Uncomment the one you wish to use. -->
<!-- Perl CGI over FastCGI -->
<!--
<add name="perl.project#x86" scriptProcessor="perl.5.12.pipe" path="*.pl" verb="*" modules="HeliconZoo_x86" preCondition="bitness32" resourceType="Unspecified" requireAccess="Script" />
<add name="perl.project#x64" scriptProcessor="perl.5.12.pipe" path="*.pl" verb="*" modules="HeliconZoo_x64" preCondition="bitness64" resourceType="Unspecified" requireAccess="Script" />
-->
<!-- Perl over FastCGI -->
<add name="perl.project#x86" scriptProcessor="perl.5.12.psgi" path="*" verb="*" modules="HeliconZoo_x86" preCondition="bitness32" resourceType="Unspecified" requireAccess="Script" />
<add name="perl.project#x64" scriptProcessor="perl.5.12.psgi" path="*" verb="*" modules="HeliconZoo_x64" preCondition="bitness64" resourceType="Unspecified" requireAccess="Script" />
<!-- Perl over HTTP -->
<!--
<add name="perl.project#x86" scriptProcessor="perl.5.12.http" path="*" verb="*" modules="HeliconZoo_x86" preCondition="bitness32" resourceType="Unspecified" requireAccess="Script" />
<add name="perl.project#x64" scriptProcessor="perl.5.12.http" path="*" verb="*" modules="HeliconZoo_x64" preCondition="bitness64" resourceType="Unspecified" requireAccess="Script" />
-->
</handlers>
<!-- URL Rewrite rules to pass static files, limit console access, etc. -->
<rewrite>
<rules>
<!-- This rule shows welcome page when no Rack application exist. -->
<rule name="Rewrite to Zoo index if that's an empty application" stopProcessing="true">
<match url="^/?$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{APPL_PHYSICAL_PATH}" pattern="(.*)" ignoreCase="false" />
<add input="{C:1}app.pl" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="public/zoo-index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Environment variables
-
APP_WORKER
— path to PSGI application’s worker script. PROXYPASS
— application virtual path.