Contents
Perl Mojolicious
Installation
-
Open Web Platform Installer and install "Perl project":
- Open project's home page and follow steps in "Mojolicous" section:
- Create app.pl file in the root of IIS web site with the following content:
use Mojolicious::Lite;
get '/' => sub { shift->render(text => '<h1>Hello from Mojolicious!</h1>') };
app->start;
Output of example Mojolicous application:
Deployment
To deploy Perl Mojolicious 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.