0

I'm using the Email::Stuffer module for sending a text message through an email in ActivePerl on Windows. This the code I'm running:

use strict;
use warnings;

use Email::Stuffer;

my $text = <<"END";
This is the email generated by Perl.
END

Email::Stuffer
     ->text_body($text)
     ->subject('Perl Email')
     ->from('abc@gmail.com>')
     ->to('xyz@gmail)
     ->send;

I'm getting error like this:

Can't locate Email/Stuffer.pm in @INC (you may need to install the Email::Stuffer module) (@INC contains: C:/Perl/site/lib C:/Perl/lib) at D:\Ekanvith
a\perl\email.pl line 4.
BEGIN failed--compilation aborted at D:\Ekanvitha\perl\email.pl line 4.
Biffen
  • 6,249
  • 6
  • 28
  • 36
Ekanvitha
  • 25
  • 3
  • 3
    Well, have you _installed_ `Email::Stuffer`? – Biffen Jun 24 '19 at 11:00
  • Find yourself a good Perl tutorial, perhaps one specifically for ActivePerl, and start there. Coming here to ask a question every time you get an error is not a Good Idea™ and it would take years just to learn the basics. – Biffen Jun 24 '19 at 11:08

1 Answers1

3

Email::Stuffer is not part of the standard Perl distribution. You need to install it before you can use it.

It's possible that it's available for installation in the ActivePerl package repository so you can install it using ppm. However, I would recommend using Strawberry Perl instead which would allow you to install CPAN modules using the standard tools.

Dave Cross
  • 68,119
  • 3
  • 51
  • 97
  • Is there any module for Activeperl because I have to run it on Activeperl only. – Ekanvitha Jun 24 '19 at 11:17
  • It's giving this error message ppm install failed: Can't find any package that provides Email::Stuffer – Ekanvitha Jun 24 '19 at 11:22
  • @Ekanvitha: Which version of ActivePerl are you using? The module seems to be [available for most modern versions](https://code.activestate.com/ppm/Email-Stuffer/). Why are you tied to ActivePerl? Strawberry Perl is a better version and is actively supported by the Perl community. – Dave Cross Jun 24 '19 at 12:25
  • @DaveCross, AP downloads offered are 5.26 and 5.28, corresponding PPM packages not ready yet? – daxim Jun 24 '19 at 13:14
  • 1
    @daxim: I'd put money on the problem being that this version of AP is too old, rather than too new :-) – Dave Cross Jun 24 '19 at 14:01
  • Can I use Net::SMTP instead of Email::Stuffer for the above program in ActivePerl 5 – Ekanvitha Jun 24 '19 at 14:41
  • @Ekanvitha: You seem to have missed my question asking which version of ActivePerl you are using. – Dave Cross Jun 24 '19 at 15:06
  • @Ekanvitha: Net::SMTP doesn't really do the same thing as Email::Stuffer. Sure, they both send emails. But Email::Stuffer does so much more to make it easy to create the email before sending it. If you want an alternative to Email::Stuffer, you should look at Email::Sender. – Dave Cross Jun 24 '19 at 15:08
  • @Ekanvitha: And, as I've mentioned before, your best approach is to switch to Strawberry Perl. What is stopping you from doing that? – Dave Cross Jun 24 '19 at 15:09