Perl Dancer is a light-weight web framework for Perl. This examples uses Dancer 1. For new projects you should use Dancer 2.

Install Dancer

First you need to install the Dancer module.

In the archive you'll find more installation methods depending on your situation.

Directory structure

.
├── bin
│   └── app.pl
└── lib
    └── App.pm

The two files:

The script to launch the application:

examples/dancer/app1/bin/app.pl

#!/usr/bin/env perl
use Dancer;
use App;
dance;

The application itself:

examples/dancer/app1/lib/App.pm

package App;
use strict;
use warnings;
use Dancer ':syntax';

get '/' => sub {
    return 'Hello World';
};


true;

cd into the root of the project and type:

plackup bin/app.pl

You can then visit http://localhost:5000/ and see the "Hello World".