Convert parameters to hash references
To convert the parameters to a hash reference, use the to_hash method of the Mojo::Parameters class.
my $hash_data = $params->to_hash;
This is a sample of Mojolicious::Lite. Converting parameters (query string, POST data, captured in URL) to hash reference.
#Mojolicious::Lite get'/' => sub { my $self = shift; my $param = $self->req->params->to_hash; };;
Get the Mojo::Message::Request object with the req method of the Mojolicious::Controller object, get the Mojo::Parameters object with the params method of the Mojo::Message::Request object, and the to_hash method from the Mojo::Parameters object. Is calling.
This is a sample of Mojolicious.
#Mojolicious package MyApp::Book; use Mojo::Base'Mojolicious::Controller'; sub register { my $self = shift; my $param = $self->req->params->to_hash; }