在这方面有几个类似的线程,但似乎通常的罪魁祸首是该人忘记安装或use
相关软件包。在这种情况下似乎并非如此。我仔细检查以确保Email::Sender
已安装
cpan[1]> install Email::Sender
Going to read '/home/ajmills/.cpan/Metadata'
Database was generated on Fri, 18 Jan 2013 07:07:06 GMT
Email::Sender is up to date (0.120002).
cpan[2]>
我的简单程序:
use strict;
use warnings;
use Email::Sender;
my $mailer = Email::Sender->new( {
mailer => 'SMTP::TLS',
mailer_args => [
Host => 'smtp.gmail.com',
Port => 587,
User => 'xxx@gmail.com',
Password => 'xxx',
Hello => 'xxx.org',
]
} );
然后运行它:
:~$ perl email.pl
Can't locate object method "new" via package "Email::Sender" at email.pl line 5.
任何的想法?