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

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

Hi Kõike hääd,

Thank you so much for the help.

Worked like charm.

Let me Know in case of any further informations required.


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

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

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

You overcomplicate your route-definition. Query string is not a part of route definition. You need only:

get '/method' => \&TEST;

And when you now query it like:


It should work fine.

If you really need URLs like


you can buid your routes with regex, something like that (code not tested):

get qr{/method/name=([\w]+)/ID=([\d]+)} => sub {
    my ($name, $id) = splat;

Then you can use all the power of regexes for your URLs.

Kõike hääd,

dancer-users mailing list
dancer-users at dancer.pm

More information about the dancer-users mailing list