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

Kadir Beyazlı kadirbeyazli at gmail.com
Thu Sep 17 17:22:38 BST 2015


17 Eyl 2015 18:31 tarihinde "Richard Reina" <gatorreina at gmail.com> yazdı:
>
> 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
either.
>
> Here is where I am:
>
>  get '/reset/:token' => sub {
>
>     my $incoming_token;
>
>     return template 'passreset' => {
>
>           $incoming_token = params->{token},          # LINE 554
>
>     };
You dont need define variable here. Also you should use "=>" instead of "="
as follow.

incoming_token => params->{token}

>
>     # 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.
>
> Thanks
>
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20150917/48ed1add/attachment.html>


More information about the dancer-users mailing list