[wellylug] Perl Help
grant at mclean.net.nz
Mon Sep 13 11:11:36 NZST 2004
On Mon, 2004-09-13 at 10:44, Chris Hodgetts wrote:
> I am trying to use perl mail modules, and I think I have installed the
> correct ones, but clearly not, because I am getting the following error:
> Can't call method "mail" on an undefined value at
> /home/test/serv5/testS5.pl line 59.
> Debian Unstable is the distro I am using, can anyone let me know what
> packages "Should" be installed for this to work?
Hmm, that message doesn't give us much to go on and it certainly
doesn't imply that the cause is a missing package.
Presumably line 59 of the script has something like this:
The error message is telling us that the variable ($some_var in the
example above) is empty when the script expects it to contain an
object of some sort. This in turn implies that an earlier line in
the script attempted to create an object, perhaps like this:
$some_var = Net::SMTP->new('stmp.some.domain');
And that line is failing for some reason. A better way to write that
line would have been:
$some_var = Net::SMTP->new('stmp.some.domain') or die "$!";
That way you'd get an error indication at the time of the actual
failure rather than later on.
My examples assume the Net::SMTP module was being used. This is part
of the core Perl distribution. In your case, it could well be a
completely different module - typically included near the start of
the script with a line like this:
More information about the wellylug