CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Variable "$Response" is not imported. Global symbol "$Response" requires explicit pac

 



huareu
Deleted

Oct 19, 2000, 11:25 AM

Post #1 of 1 (411 views)
Variable "$Response" is not imported. Global symbol "$Response" requires explicit pac Can't Post

The original error message occurred after submiting Feedback.htm,

} else { $Mailer->AddRecipient('' , 'name1@company.com' ) ; error '80004005'
Can't call method "AddRecipient" on unblessed reference.
/feedback.asp, line 35


The original code as follow:

<%@ LANGUAGE = PerlScript%>
<html>
<body>
<table>
…..
</table>

<%
$MAILHOST = company.com'; ## SMTP server for email page.
$Mailer = $Server->CreateObject("SMTPsvg.Mailer");

$Mailer->{'FromName'} = $Request->Form('Name')->item;
$Mailer->{'FromAddress'} = $Request->Form('Email')->item;
$Mailer->{'RemoteHost'} = $MAILHOST;
$Mailer->{'Subject'} = "Comment from Feedback Page";
$Mailer->{'BodyText'} = "Company / Institution: " . $Request->Form('Company')->item . "\n" .
"Telephone Number: " . $Request->Form('Telephone')->item . "\n" .
"Sender IP Address: " . $Request->ServerVariables('REMOTE_ADDR')->item . "\n\n\n" .
$Request->Form('Comments')->item;

if (! $Request->Form('Name')->item &#0124; &#0124; ! $Request->Form('Email')->item &#0124; &#0124; ! $Request->Form('Comments')->item) {
$Response->write("<BR>Error! You must fill in the Name, Email, and Comments fields. Press the back button on your browser to return to the form.<BR>");
} else {
$Mailer->AddRecipient('' , 'name1@company.com' ) ;
$Mailer->AddRecipient('' , 'name2@company.com' ) ;
$Mailer->AddRecipient('' , 'name3@company.com) ;
if ($Mailer->SendMail()) {
$Response->write("<P><FONT Size=+1>Thank you for your comments. They have been successfully sent.</FONT>");
} else {
$Response->write('<P><FONT Size=+1>An Error has occurred. Your comments have not been successfully sent.<BR>
<a href="mailto: name2@company.com">Try clicking here to invoke your local mail program
to E-mail name2@company.com</a></FONT>' );
}
}
%>

….
</body>
</html>

The first reply I got is this:

“Are you sure that
$Mailer = $Server->CreateObject("SMTPsvg.Mailer");
creates an Object? You should check this. With
$Win32::OLE::Warn = 3;
every COM error is immediately reported and your script dies.
Hope that helps”

Then I inserted use strict and my before variables, and got a new error message.

} $Response->writeblock(1); error '80004005'
Variable "$Response" is not imported. Global symbol "$Response" requires explicit package name at (eval 10) line 28.
/feedback.asp, line 45
Can you help? Thank you.


<%
use strict;
$Win32::OLE::Warn=3;
my $MAILHOST = ‘company.com'; ## SMTP server for email page.
my $Mailer = my $Server->CreateObject("SMTPsvg.Mailer");
$Mailer->{'FromName'} = my $Request->Form('Name')->item;
$Mailer->{'FromAddress'} = $Request->Form('Email')->item;
$Mailer->{'RemoteHost'} = $MAILHOST;
$Mailer->{'Subject'} = "Comment from PWD Feedback Page";
$Mailer->{'BodyText'} = "Company / Institution: " . $Request->Form('Company')->item . "\n" .
"Telephone Number: " . $Request->Form('Telephone')->item . "\n" .
"Sender IP Address: " . $Request->ServerVariables('REMOTE_ADDR')->item . "\n\n\n" .
$Request->Form('Comments')->item;

if (! $Request->Form('Name')->item &#0124; &#0124; ! $Request->Form('Email')->item &#0124; &#0124; ! $Request->Form('Comments')->item) {
my $Response->write("<BR>Error! You must fill in the Name, Email, and Comments fields. Press the back button on your browser to return to the form.<BR>");
} else {
$Mailer->AddRecipient('' , 'name1@company.com' ) ;
$Mailer->AddRecipient('' , 'name2@company.com' ) ;
$Mailer->AddRecipient('' , 'name3@company.com) ;
if ($Mailer->SendMail()) {
my $Response->write("<P><FONT Size=+1>Thank you for your comments. They have been successfully sent.</FONT>");
} else {
my $Response->write("<P><FONT Size=+1>An Error has occurred. Your comments have not been successfully sent.<BR>
<a href="mailto: name2@company.com">Try clicking here to invoke your local mail program
to E-mail name2@company.com </a></FONT>");
}
}
%>



 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives