in reply to Re: Re: Software Error: Close.pm
in thread Software Error: Close.pm
I was just quoting what was in the perldoc.
Part of the problem is I excerpted too fast leaving out my $mailer = new Mail::Mailer; - see below.
$mailer->open(\%headers); is giving the open method a reference to the hash %headers, so the following are equivalent:
andmy $mailer = new Mail::Mailer; my %headers = ( To => 'test@tester.com, From => 'tester', Subject => 'results of submit', ); $mailer open(\%headers);
my $mailer = new Mail::Mailer; $mailer->open({ To => 'test@tester.com, From => 'tester', Subject => 'results of submit', });
Those two are equivalent because the first creates a hash then hands open() a reference to it using the backslash to take the reference. The second creates a hashref in place by enclosing the contents of the hash in curlie brace {} instead of the normal ().
And yes the error message 'Global symbol "$body" requires explicit package name' does mean you're using strict and need to declare the variable using my. Congratulation on using strict - it's a very good habit to get into.
Having used the open() method, you would then say:
print $mailer $query->param('Title'); print $mailer $query->param('Name'); print $mailer $query->param('Position'); # etc for rest of params $mailer->close;
All code here is untested, BTW.
--Bob Niederman, http://bob-n.com
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Software Error: Close.pm
by Nickd_69 (Novice) on Aug 22, 2003 at 04:32 UTC | |
by bobn (Chaplain) on Aug 22, 2003 at 04:49 UTC |