How do I decode a CGI form?

A lot of people are tempted to code this up themselves, so you've probably all seen a lot of code involving $ENV{CONTENT_LENGTH} and $ENV{QUERY_STRING}. It's true that this can work, but there are also a lot of versions of this floating around that are quite simply broken!

Please do not be tempted to reinvent the wheel. Instead, use the CGI.pm or CGI_Lite.pm (available from CPAN), or if you're trapped in the module-free land of perl1 .. perl4, you might look into cgi-lib.pl (available from http://www.bio.cam.ac.uk/web/form.html).