[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] smtp



On Tue, Jan 25, 2000 at 02:09:10PM +0200, trakais wrote:

> i'm trying to run script sending form data to an email
> in return such a error mesagge:
> 
> "Diagnostic Output
> # Can't call method "mail" without a package or object reference."
> 
> 
> what did i wrong?

>         my $smtp = new Net::SMTP(smtp.parks.lv);

You didn't check the return value from new().  In this case, new() returned
undef, because smtp.parks.lv is the concatenation of three barewords,
resulting in 'smtpparkslv', which is not a valid SMTP server.  So you also
forgot use strict and -w, either of which would have highlighted this
error.


my $smtp = new Net::SMTP 'smtp.parks.lv' or
   die "Error creating SMTP object.\n";



>         $smtp->mail($myemail);

So you're calling the method mail() on an undefined value, which is
neither a package nor an object reference.


Ronald

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org