Can I have regular parameters along with CGI::Application::Dispatch?

327 views Asked by At

I appreciate the ability to be able to do: http://server/controller/runmode or even http://server/controller/runmode/id. But if I have a lot of optional parameters I'd like to be able to do the regular: http://server/controller/runmode?foo=bar&baz=frew, especially since I have a lot of JS that will do the latter for me. Does anyone know of a way to allow for this functionality?

Thanks!

Edit: Ok, I figured it out with help from mpeters. To get params generated by CAD you obviously just do $self->param('foo'), but if you want regular params you do $self->query()->param('bar')

2

There are 2 answers

0
Frew Schmidt On BEST ANSWER

Edit: Ok, I figured it out with help from mpeters. To get params generated by CAD you obviously just do $self->param('foo'), but if you want regular params you do $self->query()->param('bar')

0
mpeters On

You don't have to do anything magical for that to work, it'll work by itself. You just retrieve them differently. If it's coming from the CGI query string then you get it by

$self->query('param_name')

If it's coming from the PATH_INFO (the part that CGI::Application::Dispatch handles) then you get it by

$self->param('param_name')