[Dancer-users] Minimum code required to get Dancer up and running?

Flavio Poletti polettix at gmail.com
Fri Feb 25 18:10:28 CET 2011


0. You pay only for what you use:

   perl -MDancer -e 'get "/" => sub {return "Hello, World!"}; dance'

1. There seems to be an undocumented configuration feature that lets you
specify the base directory for templates:

   perl -MDancer -e 'set views => "foo"; get "/" => sub {template "bar"};
dance'

(this takes foo/bar.tt instead of views/bar.tt), I wonder if this can be
made official and documented.

2. No restriction regarding the project directory name, just try it :-) The
normal startup script is a standard Perl program:

#!/usr/bin/env perl
use Dancer;
use WhateverName::YouLike::ForYour::DancerApplication;
dance;


Cheers,

    Flavio.



On Fri, Feb 25, 2011 at 5:03 PM, Brian E. Lozier <brian at massassi.com> wrote:

> I'm going to do a test implementation of a dancer web app into an
> existing project.  I would like to know the minimum files I need to
> create in order to get it running.  My intention is not to use the
> scaffolding script to create files as 1) it creates a bunch of files I
> don't need [but I don't know which ones are strictly required], 2) it
> creates a directory structure designed to house all my code, but I
> already have a directory structure [that might not match Dancer's
> exactly], and 3) I find scaffolding scripts hide a bunch of
> information that it's really better for me to understand instead of
> gloss over.  I would essentially like to start from scratch.  If there
> is not already documentation on this and I get some feedback here,
> I'll be happy to write a document and submit it back to the list.
>
> I have a couple other questions as well.
>
> 1. Is it possible for me to specify the "templates" directory as
> something other than "views" (we use "template" function in the code,
> it makes more sense to load it from a "templates" directory instead of
> a "views" directory)?
> 2. Is there an in-code restriction that requires me to have the
> directory name of my project (like "myproject") match the name of the
> dancer app module (myproject.pm)?  I ask because it's not perlish to
> have a lower-cased module (like myproject.pm) but I don't want to name
> my directory MyProject because it's annoying to type.  Generally lower
> case module names are reserved for pragmas (like warnings, strict,
> feature, etc.).
>
> Thanks in advance for any help,
> Brian
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20110225/3d861e3e/attachment.htm>


More information about the Dancer-users mailing list