Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??

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

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.