Re: arrange form data in same order as on form

From: A. Sinan Unur (asu1_at_c-o-r-n-e-l-l.edu)
Date: 11/14/03


Date: 14 Nov 2003 02:05:52 GMT

Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in news:bp1c15$1in3ke$1@ID-
184292.news.uni-berlin.de:

> Eric Schwartz wrote:
>> Gunnar Hjalmarsson <noreply@gunnar.cc> writes:
>>>>>> bbxrider wrote:
>>>>>>
>>>>>>> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
>>>
>>> Still don't understand what it is that makes the above code
>>> "buggy".
>>
>> The read() may not read $ENV{'CONTENT_LENGTH'} bytes into $buffer,
>> and there's no attempt made to detect or handle this event.
>
> Some kind of exception handling is most often useful, but the lack of
> it isn't exactly a _bug_, is it?

OK, you can call it something else then. Let's assume you don't care about
that. There is still the fact that

>>>>>>> @pairs = split(/&/, $buffer);

will miss pairs separated by a semicolon. In addition, parameter names are
not unescaped. What happens when the query string given is

?param=;

> I very much dislike the aggressive way in which some people here
> advocate the use of CGI, and the lack of faith that is shown in
> people's own judge.

As Eric Roode pointed out, the same exact code has been posted here
numerous times (e.g. http://groups.google.com/groups?hl=en&lr=&ie=UTF-8
&oe=UTF-8&safe=off&selm=4096148f.0310161157.9400327%40posting.google.com)
so I assumed the OP was not relying on his own judgement, but using someone
else's code. In that case, he is better off using CGI.pm.

Sinan.

-- 
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov


Relevant Pages

  • Re: question about forked processes writing to the same file
    ... > Gunnar Hjalmarsson wrote: ... I do use flock() to set an exclusive lock before ... perldoc -f flock ... Sinan Unur ...
    (comp.lang.perl.misc)
  • Re: Neat way of setting default values
    ... > Gunnar Hjalmarsson wrote: ... >> Xenna wrote: ... > underlying issue clearly. ... Sinan Unur ...
    (comp.lang.perl.misc)
  • Re: bbs problem
    ... Gunnar Hjalmarsson wrote: ... > A. Sinan Unur wrote: ... > Aren't those variables supposed to be set before the CGI object is created? ... Karlheinz ...
    (comp.lang.perl.misc)
  • Re: bbs problem
    ... Gunnar Hjalmarsson wrote in news:buk5g7$igfhp$1@ID- ... > Aren't those variables supposed to be set before the CGI object is ... Sinan Unur ... 1usa@llenroc.ude (reverse each component for email address) ...
    (comp.lang.perl.misc)
  • Re: missing 0s
    ... Min Wang wrote: ... Funny computer you have. ... How about following Anno's advice and post the exact code that ... Gunnar Hjalmarsson ...
    (comp.lang.perl.misc)