[Dancer-users] params for post route not working
GJ
gj at freeshell.org
Mon Feb 20 00:20:48 CET 2012
Hi all,
I am using Dancer 1.3092 . I can't access or use params for post routes, eg
----
post '/login' => sub {
# Validate the username and password they supplied
if (params->{user} eq 'bob' && params->{pass} eq 'a') {
session user => params->{user};
redirect params->{path} || '/';
} else {
redirect '/login?failed=1';
}
};
----
The above example is from the documentation, the result is the `else'
redirection. I tried my own code also. params->user is empty, in fact if I
dump all `params' its empty. I also tried `$user = param "user"' and every
other thing I could find in the docs, and it is the same result, nothing.
Is there something I need to set? My config.yml is as follows:
----
appname: "My::App"
# The default layout to use for your application (located in
# views/layouts/main.tt)
layout: "main"
# when the charset is set to UTF-8 Dancer will handle for you
# all the magic of encoding and decoding. You should not care
# about unicode within your app when this setting is set (recommended).
charset: "UTF-8"
#template: "simple"
template: "html_template"
engines:
HtmlTemplate:
loop_context_vars: '1'
global_vars: '1'
session: "cookie"
session_cookie_key: "xxxx"
plugins:
Database:
driver: 'mysql'
database: 'xxxx'
host: 'localhost'
username: 'xxxx'
password: 'xxxx'
----
Any help would be appreciated. Regards,
GJ
More information about the Dancer-users
mailing list