Phillip Bruce wrote:
Wiggins d'Anconia wrote:
<snip>
Well,
I'm using perl 5.8 and I'm now getting these error messages.
The errors you are getting now are because of the stricture. You have to declare the scope of all of your variables (among other things).
perldoc strict
For more info.... When debugging the script start with the first error, determine where it is being caused (line 37) and what its likely solution is. In this case the variable $mail has not been properly scoped and its first usage is on line 37. Sometimes you will get this error if you misname a variable, etc.
% ./survey.cgi Content-type: text/html
Global symbol "$mail" requires explicit package name at ./survey.cgi line 37.
Global symbol "$mail" requires explicit package name at ./survey.cgi line 41.
Global symbol "$mail" requires explicit package name at ./survey.cgi line 42.
Execution of ./survey.cgi aborted due to compilation errors.
Below is my code as it stands right now. #!/usr/local/bin/perl use strict; use warnings; use CGI; use Mail::Internet;
BEGIN { print "Content-type: text/html\n\n"; } # So we can debug using the web
# Collect parameters using CGI my $customer = param("Customer"); my $learn = param("Learn"); my $opinion = param("Site Opinion"); my $improvements = param("Site Iimprovement"); my $comments = param("comments");
my $head = Mail::Header->new; # add an error handler here for the above
$head->add(From => 'Webmaster <[EMAIL PROTECTED]>'); $head->add(To => '[EMAIL PROTECTED]'); $head->add(Subject => 'Peggy\'s Health Center Survey Response');
# Build the body of your message my $body = <<END; The following information has been sent via form:
Customer Type: $customer Where They Found US: $learn Site Opinion: $opinion Site Improvements: $improvements Comments: $comments END
#Send the message
In the following line you need a 'my' to give the variable scope....
$mail = Mail::Internet->new(Header => $head, Body => [$body], Modify => 1);
print $mail->send('sendmail'); $mail->close;
print "<H3>Return to Peggy's Health Center Web Site</H3>";
http://danconia.org
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]