Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dearest Monks,

How do I access GET query parameters when using chained catalyst endpoints? For example:

# /example/page?tag=value&tag2=value2 sub page :GET Chained('example') PathPart('') ??? { my ( $self, $c ) = @_; my $q_params = $c->req->params; ... }

Replies are listed 'Best First'.
Re: Catalyst chains and GET query parameters
by Your Mother (Archbishop) on May 31, 2019 at 20:30 UTC

    This is an odd question… there is no difference in chained controllers for query parameters, only path captures/arguments. What makes you think there is a difference? And why are you using GET in the sub definition? Catalyst::Controller::REST / ActionClass("REST") doesn’t work that way; it can be combined with chained methods though. Are you using a different RESTy non-core plugin or just making up syntax to try? These should work in your example–

    # tag=value&tag2=value2 my $tag1 = $c->req->params->{tag}; my $tag2 = $c->req->params->{tag2};
Re: Catalyst chains and GET query parameters
by daxim (Curate) on May 31, 2019 at 13:34 UTC