Peter,
Yes, using the 'print header' from CGI.pm is a good idea. However, if
you send any output to the browser _before_ issuing this command,
you'll continue to see the errors you described. Be sure to look for any
statements which would cause ouput to go to the browser before you
send the header.
BTW, you may also want to try using CGI::Carp as follows:
use CGI::Carp qw ( fatalsToBrowser );
I find this module useful during development when I don't want to go
through the logs. However, I suggest removing that line before putting
your script into production to prevent giving out too much information to
visitors.
Hope this helps,
William