[Dancer-users] Keeping values on a form

Naveed Massjouni naveedm9 at gmail.com
Fri Dec 17 00:53:29 CET 2010


On Thu, Dec 16, 2010 at 6:43 PM, David Precious <davidp at preshweb.co.uk> wrote:
>
>
> "Naveed Massjouni" <naveedm9 at gmail.com> wrote:
>
>>This may not be very secure, but this is how I achieve 'stickiness':
>>
>>get '/foo' => sub {
>>    # route code
>>    template foo => {
>>        params(),
>>        other => 'stuff',
>>    };
>>};
>>
>>By passing params() into your template vars hash, it is evaluated in
>>list context, so they will get expanded into key/value pairs and they
>>will all get propogated to your template.
>
> I believe they're already passed in under params, so you can use e.g.:
>
> [% params.foo %]
>
> Not 100% certain, though.
>
> --
> David Precious <davidp at preshweb.co.uk>
> Sent from my phone so please excuse brevity / poor quoting style etc
>

Whoa, you are right, in the template you can access params.  So now I
know of 3 things Dancer provides you in the templates: request,
session and params.  Are there any others?  Lets document this
somewhere.  Maybe in the Dancer::Template pod?

-Naveed


More information about the Dancer-users mailing list