This is really strange, but I'm not quite sure how to explain it. I have a project (full source available at Flame's scratchpad *the school project listing*) and I use Apache::Request on it. Now I've been using Apache::Request's param method to get the current params, however I'm running into a bit of difficulty now that I am using one paramater with multiple values. Now around line 113 I convert the params to a hash using the following:

my %ARGS; { #Localize @temp since I won't need it later my @temp = $state->{'r'}->param(); foreach (@temp){ $ARGS{$_} = $state->{'r'}->param($_); } }

This has worked up till now, when I needed that second value. I attempted, where I needed it (roughly line 985, the sub browse), to use the following:

my @schedules = $state->{'r'}->param('browseselect'); return qq~<tr><td>~.Dumper(@schedules).qq~</td></tr>~;

As a simple test to see that it could get these values out, however when I attempt this, the apache thread seems to lock up. As a further experement I changed the initial setup of the %ARGS hash to this:

my %ARGS; { my @temp = $state->{'r'}->param(); foreach (@temp){ $ARGS{$_} = (scalar(@{ [$state->{'r'}->param($_)] }) > 1 ? [$ +state->{'r'}->param($_)] : $state->{'r'}->param($_)) ; } }

After this change, suddenly everything is working and yielding the expected results. So I now find myself wondering why the difference. I admit this is poorly described here, I'm not sure I fully understand my question myself, but I'm really confused here. Thanks for any assistance you can give.





My code doesn't have bugs, it just develops random features.

Flame ~ Lead Programmer: GMS (DOWN) | GMS (DOWN)


In reply to Apache::Request and param($x) infinite loop? by Flame

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.