This page is located at /public/zoo-index.html

This template project allows to run Perl applications over FastCGI or HTTP using PSGI/Plack or generic HTTP/CGI application workers as backend.

Helicon Zoo is designed to run multiple environments on a single server and all application dependencies are installed into the application's web site directory. This application template is configured to use isolated environment. There is a web console that you can use to run console commands to the environment of this application. Please use this console to run all Perl commands on your application, like cpan cpanm, etc. If you use Windows console to run commands to install modules globally on the server you may be actually calling quite different instance or version of Perl (depends on your system set up) and installing modules in locations not related to this application at all. So using the provided web console and installing all modules into the application folder will easy project deployment and moving to other locations.

Click on this link to open web console. The web console will only work for local or authenticated requests and external access is restricted for security reasons. You can enable remote access to web console by setting up any authentication method for /console/ directory of the web site.

This template is configured by default to run generic Perl HTTP applications. Please review web.config file for more details.

The deploy_sample.pl script in the root folder is a sample deploy script. This sample contains commands for Dancer installation. Normally you would use this script to run some commands on the server that are required by your application deployment process, like database migrations, component installations, etc. Rename deploy_sample.pl to deploy.pl if you need to start deployment. Helicon Zoo will start execution of deployment process upon next request to the application. When deployment is finished this script will be renamed to deploy_done.pl to prevent further execution. You can read more about deployment scripts in Helicon Zoo documentation.

Below please find step-by-step instructions to run some common Perl configurations:

CGI:

  1. Create cgi.pl file with the following content:
    
    print "Content-type: text/html\r\n\r\n";
    print <<EndOfHTML;
    
    <html><head><title>Perl Environment Variables</title></head>
    <body> <h1>Hello from Perl!</h1>
    <h2>Perl CGI Environment Variables</h2>
    <pre><code>
    EndOfHTML
    foreach $key (sort(keys %ENV))
    {
      print "$key : $ENV{$key}\n";
    }
    print "</code></pre></body></html>";
            
  2. Uncomment following line in web.config:
    
    <!-- Perl CGI over FastCGI -->
    <add name="perl.project#x86" scriptProcessor="perl.5.12.pipe"
         path="*" verb="*" modules="HeliconZoo_x86"
         preCondition="bitness32" resourceType="Unspecified" requireAccess="Script" />
    <add name="perl.project#x64" scriptProcessor="perl.5.12.pipe"
         path="*" verb="*" modules="HeliconZoo_x64"
         preCondition="bitness64" resourceType="Unspecified" requireAccess="Script" />
            

PSGI/Plack

  1. Uncomment following line in web.config:
    <!-- 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"/>
          
  2. Create app.pl file with the following content:
    my $app = sub {
      return [200, ['Content-Type' => 'text/plain'], ["hello, world\n"]];
    }

HTTP with PSGI/Plack

  1. Open web console and type:
    cpanm Twiggy
  2. Comment out following lines in web.config:
    <!-- 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"/>
    -->
  3. Uncomment following line in web.config:
    <!-- 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"/>
          
  4. Write following line in <environmentVariables> section of web.config:
    <add name="APP_WORKER" value="perl5\bin\twiggy app.pl" />
  5. Create app.pl file with the following content:
    my $app = sub {
      return [200, ['Content-Type' => 'text/plain'], ["hello, world\n"]];
    }

Dancer:

  1. Open web console and type:
    cpanm Dancer
  2. Create app.pl file with the following content:
    use Dancer;
    get '/' => sub {
      return 'Hello World!';
    };
    start;
  3. Uncomment following line in web.config:
    <add name="APP_WORKER" value="app.pl" />

Mojolicious:

  1. Open web console and type:
    cpanm Mojolicious
  2. Create app.pl file with the following content:
    use Mojolicious::Lite;
    get '/' => sub { shift->render(text => 'Hello from Mojolicious!') };
    app->start;
  3. Uncomment following line in web.config:
    <add name="APP_WORKER" value="app.pl" />
Helicon Zoo · Articles  · Community · Support