|Perl Monk, Perl Meditation|
Re: Wont write to text file.by ajt (Prior)
|on Aug 01, 2002 at 10:54 UTC||Need Help??|
Good to see you using CGI, but I think you'll find adding warnings and strict is always useful too. You can start warning by adding -w to the shebang line, or on more modern Perls by loading the warning module. Turn strict on by using it too. e.g.
Looing at your code, and I assume it's a cut'n'paste, rather than a re-type, I'd say that you could clean up your open statment to something like:
Secondly you are loading all of CGI, but then doing your own HTML, which is a bit of a waste. Either load only the bits of CGI you want (e.g. use CGI qw(:cgi); or take advantage of it's HTML printing. For example:
Depending upon which version of CGI you are running you should be able to start the script from the command line, and pass dummy variables to it, which can help with debugging.
Another debugging tip from the docs is the Dump option, which will make CGI spit out in crude HTML all it's input parameters, so you can see if there is something funny going on, for example the param has a differnt name in the HTML form. See the CGI docs for more details.
UPDATE: If you are going to use the OO interface for CGI, it's better to: