route pattern

9 views
Skip to first unread message

Miguel Prz

unread,
Jul 20, 2013, 3:20:22 AM7/20/13
to perl...@googlegroups.com
I want to match a route like this:
/ajax/locations?query=a

how can I set up a route and catch "query" parameter?

thanks!

Stefan Geneshky

unread,
Jul 20, 2013, 12:50:35 PM7/20/13
to perl...@googlegroups.com
Recommended approach:

sub ajax_locations {
    my $self = shift;
    my $query = $self->param('query');
    ...
}

See https://metacpan.org/module/Kelp::Request for more info. Also, remember that Kelp::Request inherits from Plack::Request, so you can use all its methods too.

Stefan
Reply all
Reply to author
Forward
0 new messages