Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
The easiest way to write web applications with Perl (Perl web micro-framework)
Perl Perl6 Other
branch: devel

Fetching latest commit…

Cannot retrieve the latest commit at this time


The easiest way to write a webapp with Perl


This project is inspired by Ruby's Sinatra framework: a framework for building web applications with minimal effort, allowing a simple webapp to be created with very few lines of code, but allowing the flexibility to scale to much more complex applications. Dancer supports plugins to add various extra functionality you may want, whilst keeping the core streamlined.



To create a new Dancer application, use the helper script dancer provided with this distribution:

$ dancer -a MyWeb::App
+ MyWeb-App/bin
+ MyWeb-App/bin/
+ MyWeb-App/config.yml
+ MyWeb-App/environments

You then have a new Dancer application in MyWeb::App which is already a functioning Hello World application, ready for you to work upon.

Here is an example of a webapp built with Dancer:

# MyWeb-App/bin/

use Dancer;

get '/' => sub {
    "Hello There!"

get '/hello/:name' => sub {
    "Hey ".params->{name}.", how are you?";

post '/new' => sub {
    "creating new entry: ".params->{name};


When running this script, a webserver is running and ready to serve:

$ perl ./bin/
>> Listening on
== Entering the development dance floor ...

Then it's possible to access any route defined in the script:

$ curl http://localhost:3000/
Hello There!

For a more in-depth example, see examples/dancr


Dancer depends on the following modules

  • HTTP::Server::Simple::PSGI
  • HTTP::Body
  • Exception::Class
    • MIME::Types
    • URI

Optional modules may be needed if you want to use some features (but are not required for a basic usage).

Dependency-checks for additional features are performed at runtime.

Most common modules you may want are:

  • Template (for Template::Toolkit support)
  • YAML (for configuration files)
  • Plack (if you want to deploy your application with PSGI)


This is a work in progress.

Dancer supports PSGI/Plack, to run a Dancer app with PSGI/Plack just bootstrap your application with the helper script dancer like the following:

$ dancer -a MyWeb::App

You'll find a file in there called app.psgi, use this file to configure your PSGI environment, as explained in the revelant documentation of your PSGI server.

For instance, with plackup, just do the following:

$ plackup -a app.psgi


For more details about the project, checkout the official website: or checkout the documentation at

See also the Github project page: for the latest changes.


Bug reports are appreciated and will receive prompt attention - the preferred method is to raise them using Github's basic issue tracking system:


You can reach the development team on IRC: irc:// or for a web-based IRC client.

Something went wrong with that request. Please try again.