in reply to Get those parameters without CGI.pm
The above code, aside from reinventing the wheel, has a variety of problems. The most immediately obvious one is the following section of code:
This code is duplicated! It should be a subroutine.foreach $form (@form_data){ (my $one, my $two) = split(/=/, $form); if ($one =~ m/\+/){ $one =~ s/(\+)/" "/eg; } if ($two =~ m/\+/){ $two =~ s/(\+)/" "/eg; } $one =~ s/%([\da-fA-F][\dA-Fa-f])/pack("C", hex($1))/eg; $two =~ s/%([\da-fA-F][\dA-Fa-f])/pack("C", hex($1))/eg; $form{$one} = $two; $params{$one} = $two; }
If you are going to reinvent the wheel, you should only do so when you are really comfortable with the language in question. Otherwise, these problems creep in and later down the road, when you're still using your reinventions, you'll come back to them and find they need to be rewritten to get around issues like this.
And why are the hashes %forms and %params duplicated? The way they're created above, they are identical. I could go on, but that's enough for now.
Cheers!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: Get those parameters without CGI.pm
by j.a.p.h. (Pilgrim) on Jun 22, 2000 at 05:04 UTC |