Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: HTML Decoding

by abstracts (Hermit)
on Mar 17, 2002 at 11:33 UTC ( [id://152311]=note: print w/replies, xml ) Need Help??


in reply to HTML Decoding

Hello there

Why reinvent the wheel? The CGI module does exactly what you're trying to accomplish. Here is something from the CGI docs:

FETCHING THE PARAMETER LIST AS A HASH: $params = $q->Vars; print $params->{'address'}; @foo = split("\0",$params->{'foo'}); %params = $q->Vars; use CGI ':cgi-lib'; $params = Vars;
So, all you need is to create a CGI object, and get the params hash:
use CGI qw/Vars/; my %params = Vars; # now you're good to go :-)
Or, if you really want to pass your own QUERY_STRING, do it like this:
use CGI; my $q = new CGI($ENV{QUERY_STRING}); my %params = $q->Vars();
Hope this helps,,,

Aziz,,,

Replies are listed 'Best First'.
Re: Re: HTML Decoding
by emcb (Beadle) on Mar 17, 2002 at 12:10 UTC

    Hi,

    Sorry im also going blind as i did not see that, i do mean GLOENV. The reason why im doing this my own was is because this module will go into production software and i dont think i can use CGI in production software?

      People all over the globe are using this piece of (imnsho) ugly code in production, and the module has proven to be very stable and capable.

      Let me stress the last part of Juerd's sentence. CGI.pm has been extensively tested, and is very solid. It also has a huge install base and chances are most people will have easy access to it. This is why I recommend it to new monks over creating their own buggy parsers. Those who would tell people who may be new to Perl that it's 'ugly code' are not acting responsibly. This is especially the case when they don't suggest a better alternative thereby leading some to believe that rolling their own isn't such a bad idea.

      As for your concerns with using CGI.pm in production software, are they licensing related? If so CGI.pm is licensed under the same terms as Perl, from the docs:

      This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

      I'm not a lawyer, but this would lead me to believe that there are no problems with using CGI.pm in (presumably closed source) production software. Check out the Artistic license for more information.

      So you think you can produce parsing code that works better than a module that has taken a few years to write and that has been tested by several hundred thousand programers?

      Wouldn't this qualify as a bad case of over-hubris?

      The reason why im doing this my own was is because this module will go into production software and i dont think i can use CGI in production software?

      I dislike CGI.pm, but I don't see why you couldn't use it in production software. People all over the globe are using this piece of (imnsho) ugly code in production, and the module has proven to be very stable and capable.

      U28geW91IGNhbiBhbGwgcm90MTMgY
      W5kIHBhY2soKS4gQnV0IGRvIHlvdS
      ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
      geW91IHNlZSBpdD8gIC0tIEp1ZXJk
      

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://152311]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-23 07:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found