Jul 18, 2001, 1:46 AM
Post #6 of 6
Your script doesn't work for various reasons. The main problem is that you try to parse the query string, which you don't need, since the CGI module already did it for you. So throw out that query string parsing code! CGI.pm is better, easier to use, safer, very well documented. You just have to type perldoc CGI, and you can read several dozens of manual pages that describe in every detail how you can use CGI.pm. And it's really worth reading it, since CGI.pm makes your life so much easier.
Re: Need some help on a script, please help
[In reply to]
Next thing the CGI module does for you: It writes correct headers (Content-type, etc), so you don't have to do this either. You can write complete HTML documents with the built-in functions of the CGI module.
All those compilation erros you get are due to the use strict; pragma at the top of the script. It forces you to declare all your variables with my. Since you just pasted your parsing code in, and it's actually so bad that it isn't use-strict-safe, your program fails. If you need to know more about strict, type perldoc strict.
I'd say, try to read the documentation for CGI.pm. If you don't understand something in the docs, ask here. Then try to understand the piece of code I posted above. If you should still have problems understanding that code, ask here. But please don't paste code you don't understand completely into other code you don't understand completely, expect this code to work, and ask why it fails.
If you think that lack of Perl knowledge is your problem, try one of the many Perl tutorials there are on the web. One good Perl tutorial is Rob's Perl tutorial. It's always better to have some basic knowledge before starting with special applications of a language (i.e. CGI programming). That often means fighting two battles at the same time.
I hope this helps.