DreamT has asked for the wisdom of the Perl Monks concerning the following question:

Hi all!
I'm using the following code to extract form values:
sub Get_formvalues() { my (%ReturnVariable); if (($ENV{'REQUEST_METHOD'} eq "GET") || ($ENV{'REQUEST_METHOD'} e +q "POST")) { my @keywords = $query->param; foreach my $name (@keywords) { my @values = $query->param($name); foreach my $value (@values) { if ($ReturnVariable{$name}) { $ReturnVariable{$name} .= "\n$value"; } else { $ReturnVariable{$name} = $value; } } } } return (%ReturnVariable); }
This makes it possible for me to get the formvalues via local %formvariables = Get_formvalues(); and to access them via $formvariabel{'name'} This works perfectly and has done that for several years.
A while ago however, we've ran into problems where these values has been empty, and we have narrowed it down to that only some users using "AppleWebKit"-based browsers generates the problem (for example HTTP_USER_AGENT = Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; sv-se) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1).
My questions:
1. Is this "manageable"?
2. Is this possible to trace a broken form if that is the problem?
3. Is this a known problem?

Replies are listed 'Best First'.
Re: FastCGI form debugging
by wol (Hermit) on Apr 16, 2009 at 09:59 UTC
    A while ago however, we've ran into problems where these values has been empty, ...

    I'm not sure where you're describing the problem existing. Do you mean that:

    1. The browser isn't sending some/all of the form data to the server,
    2. It's sending it to the browser but getting lost somewhere after that, or
    3. You can't work out which of 1 or 2 is happening.

    --
    use JAPH;
    print JAPH::asString();

      I would have to say number 3, but I think that it leans more towards number 2 than number 1.

      :-)
Re: FastCGI form debugging
by Anonymous Monk on Apr 16, 2009 at 11:50 UTC
    Do you understand that your sub Get_formvalues() is a closure?
    while ( my $q = new CGI::Fast ) { my %formvariabel = Get_formvalues($q); } sub Get_formvalues { my $query = shift; my $request_method = $query->request_method; if ( $request_method eq 'GET' || $request_method eq 'POST' ) { return map { $_ => join "\n", $query->param($_) } $query->para +m; } }
      What exactly do you mean by "a closure"?
      I'm not an expert on english so..:-)