[dancer-users] How to pass Named Arguments in Dancer URL

Parthiban, Anandaraaj anandaraj.parthiban at cgi.com
Wed Sep 16 11:21:26 BST 2015


Thanks Kõike hääd,



But I can't get this going.



My Sample Code:



sub TEST {

            my $name = param('test');

            my $ID = param('ID');

            return {Message => "Welcome to Montoo Update Event $name $ID"};

}



get '/method/Entity=:test&ID=:ID' => \&TEST;







Let me Know in case of any further informations required.



Thanks

Anand.





-----Original Message-----
From: dancer-users [mailto:dancer-users-bounces at dancer.pm] On Behalf Of WK
Sent: Wednesday, September 16, 2015 3:40 PM
To: Perl Dancer users mailing list
Subject: Re: [dancer-users] How to pass Named Arguments in Dancer URL



2015-09-16 12:39 GMT+03:00 Parthiban, Anandaraaj <anandaraj.parthiban at cgi.com<mailto:anandaraj.parthiban at cgi.com>>:



> But How do we pass that

>

> Let me Know in case of any further informations required.



get '/method' => sub {

  # you have two ways to access params from query string :

  # first, there is Dancer keyword `param`

  my $name = param('name');



  # second, there is Dancer method `params`

  my $id = params->{ 'id' };



  # do whatever you need here

};



Wbr,

--

Kõike hääd,



Gunnar

_______________________________________________

dancer-users mailing list

dancer-users at dancer.pm<mailto: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/20150916/9a97aa2e/attachment.html>


More information about the dancer-users mailing list