Try $c->req->params
<https://mojolicious.org/perldoc/Mojo/Message/Request#params>

pairs() is what you're looking for but you might consider append() and
merge() as well.

$c->req->params->pairs([a => 'b', b => 'c']);

I haven't tried it myself, but the documentation seems to indicate to me
this would work!  :D

On Sat, Sep 29, 2018 at 1:16 PM Viktor Nacht <[email protected]> wrote:

> So I have a simple hash:
>
> { a => 'b', b => 'c' }
>
> That I would like to turn into params per the
> Mojolicious::Plugin::TagHelpers docs:
>
> You can also use "param" in Mojolicious::Plugin::DefaultHelpers to set
>> them manually and let necessary attributes always be generated
>> automatically.
>
>
> It appears $c->param can only set one parameter at a time. Obviously I
> could write a helper to copy the hash over one param at time, but I was
> wondering if there was a more elegant way to do it. For example, is there a
> way to access the Mojo::Parameters append method from the controller?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mojolicious" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/mojolicious.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to