Reputation: 91
If I use: my $transport = Email::Sender::Transport::SMTP->new(some parameters)
PERL says: Can't locate object method "new" via package "Email::Sender::Transport::SMTP"
And yes, there is no sub new
inside SMTP.pm
Upvotes: 0
Views: 1655
Reputation: 181
The module Email::Sender::Transport::SMTP is based on Moo. Those Moo framework will create the new sub automatically. So its okay that you dont find a new sub in the SMTP.pm file itself.
Do you have added the proper load statement for Email::Sender::Transport::SMTP to your source files?
use Email::Sender::Transport::SMTP;
The mentioned error message comes up if the related module dont got loaded, e.g.
perl -e "my $transport = Email::Sender::Transport::SMTP->new();"
Can't locate object method "new" via package "Email::Sender::Transport::SMTP"
vs.
perl -e "use Email::Sender::Transport::SMTP; my $transport = Email::Sender::Transport::SMTP->new();"
[ALL OK]
Upvotes: 6