Scripts ending in .pl will be executed within a Perl CGI handler.


Perl modules can be installed into your own repository with the cpanm command. SAA will assist upon request if header files or required libraries are missing.

You can set up a module environment in ~/perl5 with:

$ eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`
$ echo 'eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`' >> ~/.profile

Now you can install a module with cpanm <modulename>.

You can add ~/perl5 to Perl's @INC module include path by adding the following line at the top of your script:

use local::lib;

Then you can use any modules you have installed.

Example application

You can use the Mojolicious framework to create web applications of any size. The Lite version makes small applications particularly easy to create:

use Mojolicious::Lite;

get '/' => { text => 'Hello, world!' };


Example basic CGI script


print("Content-Type: text/plain\n\n");

foreach $var (sort(keys(%ENV))) {
   $val = $ENV{$var};
   $val =~ s/\n/\\n/g;
   $val =~ s/"/\\"/g;
   print "${var}=\"${val}\"\n";