[dancer-users] route handler for a URL that matches a token

Richard Reina gatorreina at gmail.com
Thu Sep 17 16:31:39 BST 2015

2015-09-17 9:06 GMT-05:00 Andrew Solomon <andrew at geekuni.com>:

> That looks reasonably sane to me apart from:
>   my $input_hash {
>     token => params->{token}
>     }
> which should be
>   my $input_hash =  {
>     token => params->{token}
>     };
> Hi Andrew,

That piece of code is the part that is giving me trouble.

I have switched to using a scalar as since there is only one element that I
seek to capture (the usrl/token) and because using a hash wasn't working

Here is where I am:

 get '/reset/:token' => sub {

    my $incoming_token;

    return template 'passreset' => {

          $incoming_token = params->{token},          # LINE 554


    # get stored tokens to match against $incoming_token
    my ($matched_user_id) = User->lookup_tokens($input_hash->{token});

But the it fails and the input at the console says:

[MyApp:25074] core @2015-09-17 10:21:52> Entering hook
core.app.before_request in (eval 77) l. 1
Odd number of elements in anonymous hash at
/home/richard/Dancer2/MyApp/bin/../lib/MyApp.pm line 554.

I am just trying to capture the value of the url so I can test if it
matches the stored token.  Help would be greeeaaaaaaatly appreciated as
this s very frustrating.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20150917/5c382e55/attachment.html>

More information about the dancer-users mailing list