Anonymonk covered Hash::MultiValue. All you need–

my $params = $form->body_parameters->as_hashref; # or my %params = %{$form->body_parameters};

Some tips. use strict 'refs' is code smell. It’s half way to not using strict at all which is, for any code longer than you can easily understand in a glace, like swimming while carrying a brick.

I was surprised to see that the following is apparently reliable and even approximately shown in the docs for keys. I was surprised because hash keys are “unordered” so this looks funky but the values and keys are “unordered” in the same way so… Anyway, it seems a bit too clever to me and might lead you to believe you can rely on order between different hashes.

my @k = keys %$form; my @v = values %$form; @form_hash{@k} = @v;

I am absolutely not trying to dissuade you from learning and experimenting. That said, Plack is not meant for what it seems like you’re doing. It’s a low level toolkit, not a web application framework. Keep playing around. It’s fun. Consider picking up Mojolicious or another webapp framework if you’re serious about making code for anyone but yourself. There are many parts that are either done already or make everything much easier. The suggestion about Plack::App::WrapCGI may also be cromulent. Your old FCGI code could likely just be wrapped up. The CGI code has to be pretty clean but the error feedback is quite good, though nothing you’d ever want to expose to users, so…


In reply to Re: How to loop through Plack::Request body_parameters ? by Your Mother
in thread How to loop through Plack::Request body_parameters ? by knox

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.