Dancer (software)

{{Short description|Web framework}}

{{About|the web framework|the biological database|DAnCER (database)}}

{{Infobox software

| name = Dancer

| logo = Dancer logo.png

| screenshot =

| caption =

| collapsible =

| author = Alexis Sukrieh

| released = {{Start date|2009|07|27}}

| latest release version = {{Dancer (software) version}}

| latest release date = {{Dancer (software) version|releasedate}}

| latest preview version =

| latest preview date =

| programming language = Perl

| operating system = Cross-platform

| platform =

| size =

| language =

| genre = Web application framework

| license = GPL and PAL

| website = {{Official URL}}

}}

Dancer is an open source lightweight web application framework written in Perl and inspired by Ruby's Sinatra.

In April 2011, Dancer was rewritten from scratch and released as Dancer2. The reason for the rewrite was to fix architectural issues and eliminate the use of singletons.{{cite web|url=http://www.josetteorama.com/all-about-dancer-interview-of-sawyer-x-part-2/|title=All About Dancer - In Conversation With Sawyer X Part 2}} Development of Dancer1 was at first frozen, but was later continued to maintain backward compatibility for existing apps.{{cite web|url=http://blog.sukria.net/2013/02/18/dancer-1-and-dancer-2-what-were-going-to-do/|title=Dancer 1 and Dancer 2, what we’re going to do|access-date=2015-01-20|archive-url=https://web.archive.org/web/20150120202830/http://blog.sukria.net/2013/02/18/dancer-1-and-dancer-2-what-were-going-to-do/|archive-date=2015-01-20|url-status=dead}}

Dancer is developed through GitHub, with stable releases available via CPAN. Dancer2 is released as a separate module.

Example

  1. !/usr/bin/env perl

use Dancer2;

get '/hello/:name' => sub {

return "Why, hello there " . route_parameters->get('name');

};

get '/redirectMeTo/:trgval' => sub {

redirect '/' . route_parameters->get('trgval');

};

start;

Features

= Out-of-box =

Unlike other frameworks such as Catalyst, Dancer only requires a handful of CPAN modules and is very self-contained.

= Standalone development server =

Dancer includes a standalone development server that can be used for developing and testing applications.

= PSGI / Plack support =

Dancer supports the PSGI specification, and can thus be run on any compliant PSGI server, including Plack, uWSGI or [http://mongrel2.org/ Mongrel 2].

= Abstracted =

Since most parts of Dancer are abstracted and has a plugin architecture, extending Dancer is fairly straightforward, and a thriving community has sprung up around building these extensions.

Dancer features a lightweight object system, exception throwing similar to Try::Tiny, and is fast, especially in CGI environments.

See also

{{Portal|Free and open-source software}}

References

{{reflist}}