[Dancer-users] Very strange error

Anton Ukolov sugar.61rus at gmail.com
Wed Nov 17 11:36:46 CET 2010


Hi, guys!

First, I want to say 'thanks' for this beautiful framework! Good job, guys!

And second.
I have started to learn about this tool. I found good beginner's reference:
https://github.com/sukria/Dancer/blob/master/lib/Dancer/Tutorial.pod

I understand that this is  beta version of a tutorial, because it contains
several non-critical mistakes. But in the snippet, that lies bottom, I have
discovered some strange error. Then I start app, and try to post login and
passw in my browser, I get Runtime error, in first case:

Not a CODE reference at ./dancr.pl line 113, <DATA> line 16.

and in other cases:

Not a CODE reference at ./dancr.pl line 113

I tried other variations, but nothings worked... I tried to replace
the "params->{'username'}" and "setting('username')"
with plain scalars (like 'admin' and 'admin'), but I got same error at
the same line.

Help my please, I don't know really what is it. Is this my error? Or
is it some bug?

<code>

108  any ['get', 'post'] => '/login' => sub {
109  my $err;
110
111    if ( request->method() eq "POST" ) {
112    # process form input
113      if ( params->{'username'} ne setting('username') ) { # << error is
here
114        $err = "Invalid username";
115      }
116      elsif ( params->{'password'} ne setting('password') ) {
117        $err = "Invalid password";
118      }
119      else {
120        session 'logged_in' => true;
121        set_flash('You are logged in.');
122        redirect '/';
123      }
124    }
125
126    # display login form
127    template 'login.tt', {
128    'err' => $err,
129  };
130};
</code>

p.s. perl's version is 5.8.9, OS is Linux

best regards,
Anton Ukolov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20101117/9efc6030/attachment.htm>


More information about the Dancer-users mailing list