Questions tagged [dancer]

Dancer is a lightweight yet powerful web application framework for Perl, inspired by Sinatra. It aims to be simple, flexible, and easy to get to grips with.

Dancer is a micro web application framework for Perl, originally inspired by the Sinatra framework in Ruby.

Dancer is designed to be as effortless as possible for the developer, taking care of the boring bits as easily as possible, yet staying out of your way and letting you get on with writing your code.

Dancer offers the flexibility to scale between a very simple lightweight web service consisting of a few lines of code in a single file, all the way up to a much more complex fully-fledged web application with session support, templates for views and layouts, etc.

There are a wide variety of Dancer plugins available on CPAN to make common tasks easy (for example, database access, sending email, sending SMS text messages, interacting with Facebook).

There are also various template engine wrappers available for common templating engines such as Template Toolkit, HTML::Template, Mason and many more; writing additional wrappers for new templating engines is easy too.

Getting help

Dancer developers tend to monitor questions on Stackoverflow tagged 'dancer'.

There is an active IRC community on irc.perl.org/#perl (web chat client available).

There's also a mailing list.

Related tags:

264 questions
5
votes
1 answer

Perl dancer and Template Toolkit: Including template within template

I am trying to INCLUDE a template within a template, like so: parent.tt
[% INCLUDE my_sidebar]
my_sidebar.tt exists in same folder as parent.tt (/myapp/views) I…
5
votes
2 answers

How can I avoid encoding errors using Net::OpenID::Consumer with Yahoo OpenIDs?

I've written a Dancer web app that utilizes Net::OpenID::Consumer to consume OpenIDs for authentication. It works well with Google and MyOpenID, but not Yahoo. When a user tries to authenticate using their Yahoo account, HTML::Parser…
kbosak
  • 2,132
  • 1
  • 13
  • 16
4
votes
1 answer

Using Integrated Windows Authentication in a Perl Dancer App

I am currently building a web app with Perl Dancer. This app requires users to authenticate using my company's Active Directory. To avoid prompting users for their usernames and passwords, I would like to use Integrated Windows Authentication. …
4
votes
3 answers

Is there a way to allow multiple connections to Dancer2

My program: #!/usr/bin/perl use strict; use warnings; use Dancer2; $| = 1; set host => '127.0.0.1'; set port => 7071; get '/foo' => sub { `sleep 5`; 'ok' }; start; Then I am run the following for loop: for i in $(seq 1 3) > do > time…
Ren
  • 2,852
  • 2
  • 23
  • 45
4
votes
1 answer

Perl Dancer2 default route failing

I am wanting to not have perl dancers default 404 "Sorry, this is the void." response come up when ever a matching route cannot be found. I also need to do some other task such as error logging when ever this happens. Here is dancers documentation i…
jeffez
  • 185
  • 1
  • 12
4
votes
1 answer

How to create 'globally' scoped variables that are global only during one request?

When a request hits my dancer2 app I want to set up an object that is accessible by all packages involved in handling this request. How can I make sure that this object has a scope only within this individual request and is not accessible by other…
Joe
  • 43
  • 3
4
votes
2 answers

Redirect and Restore STDERR in Dancer

When starting my http server I don't want to see >> Dancer2 v0.201000 server listening on http://0.0.0.0: printed on the stderr. Thats why I added the following line before calling start() get "/pwd" => sub { my $pwd = cwd; print…
bob_saginowski
  • 1,429
  • 2
  • 20
  • 35
4
votes
2 answers

Perl Dancer - JSON serializer and JSON arrays

I have a problem working with the built in Perl Dancer serializer for JSON and JSON arrays. I activated the serializer in the app.pl file: #!/usr/bin/env perl use Dancer; use main; set serializer => 'JSON'; dance; In the module itself I tested…
meltdown90
  • 251
  • 1
  • 11
4
votes
4 answers

Generate unique random strings

I am writing a very small URL shortener with Dancer. It uses the REST plugin to store a posted URL in a database with a six character string which is used by the user to access the shorted URL. Now I am a bit unsure about my random string generation…
Demnogonis
  • 3,172
  • 5
  • 31
  • 45
4
votes
1 answer

How do I properly implement Net::OpenID::Consumer for Google logins and request the user's email?

I've been able to use Net::OpenID::Consumer with success, but when I started requesting the user's email address Google now prompts the user to authorize the sharing of their email address. This happens every single time, regardless of whether the…
kbosak
  • 2,132
  • 1
  • 13
  • 16
3
votes
3 answers

How to add a vmethod to template toolkit when using Dancer?

How to add a vmethod to template toolkit when using Dancer? If there isn't a way, how can I add a function /how to execute a ref to function which is added to the tokens/?
bliof
  • 2,957
  • 2
  • 23
  • 39
3
votes
0 answers

How to `send_error` from `before` hook at dancer?

My dancer version is 1.35. I can not find correct way to return error to user from before hook. #!/usr/bin/env perl use Dancer; set port => 8080; hook before => sub { Dancer::send_error('Hello', 422 ); }; get '/hello/:name' => sub { …
Eugen Konkov
  • 22,193
  • 17
  • 108
  • 158
3
votes
0 answers

How do I configure Dancer2 with mod_proxy_fastcgi

The Dancer2 Manual gives examples for mod_proxy and mod_fastcgi but in Ubuntu 18.04 the mod_fastcgi is removed. So are there any examples out there using Dancer2 with mod_proxy_fcgi? Edit: If I have to use mod_proxy instead, how do I startup my…
tejas
  • 1,795
  • 1
  • 16
  • 34
3
votes
2 answers

How to prevent serialisation in one route in a perl dancer app?

I 've got a perl dancer app (providing a rest api) which works fine with JSON (de-)serialization. Now I'm need one additional special route, that provides a (dynamically created) csv file for download. Here is the sample code: #!/usr/bin/env…
dontPanic
  • 111
  • 8
3
votes
2 answers

How to run multiple perl Dancer2 apps in same nginx server

I figured that I can manage multiple apps using location in nginx. But it seems like I cannot run multiple dancer2 apps in same server with different ports (like localhost:3000, localhost:4000). Anyway I'm putting this here with a hope that…
Yasiru G
  • 6,886
  • 6
  • 23
  • 43
1 2
3
17 18