Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which package from CPAN should I use to send mail?

Tags:

module

perl

cpan

Which package from CPAN should I use to send mail?

Sometime the timtowtdi approach is very tiring. For me, especially when it comes to package selection.

So all I want is to send email, potentially HTML emails. Between Mail-Sendmail, Mail-Sender, NET-SMTP (by the way - not available in PPM), Mail-SendEasy, and the 80 or so other packages that have 'Mail' in their package name - which one should I choose?

And while in this subject, what is your general apprach to choose the "canonical" package for a jog. I.e. the package that "everybody is using". Is there any rating or popularity billboard somewhere?

like image 558
Uri Avatar asked May 27 '10 08:05

Uri


3 Answers

what is your general apprach to choose the "canonical" package for a jog. I.e. the package that "everybody is using". Is there any rating or popularity billboard somewhere?

When I want to pick which of several CPAN modules to use, the things I look at are

Documentation:

The litmus test for CPAN modules is the first page of the documentation. If there is a messy synopsis, or a synopsis without a simple working example, I guess that the module is probably not a good one. Untidy, messy, or misformatted documentation is also a red flag.

State of repair:

  • the date of release of the last version of the module tells you if it is being maintained,
  • the CPAN tester's reports tell you whether the module is likely to install without a struggle
  • the bugs list on rt.cpan.org gives you some idea of how active the author is about maintaining the module.

Also, is there a mailing list for the module? Having a mailing list is a pretty good sign of a good-quality, maintained, stable, documented and popular module.

Author:

  • What is the name of the module author?
  • How many other modules has the author released?
  • What kind of modules has the author released?

The author is a big factor. There are some authors who create things which have excellent quality, like Gisle Aas, Graham Barr, Andy Wardley, or Jan DuBois, and some people who turn out a lot of things which could be described as "experimental", like Damian Conway or Tatsuhiko Miyagawa. Be wary of people who've released a lot of Acme:: (joke) modules. Also, beware of things written by people who only maintain one or two modules. People who have fewer than five modules in total usually don't maintain them.

Other things:

cpanratings.perl.org is often helpful, but take it with a grain of salt.

Apart from that, a lot of it is just trial and error. Download and see if it passes its own tests, see if it even has any tests, write a test script, etc.

Things which often don't give a meaningful ranking:

  • The top results on Google tend to be ancient Perlmonks or perl.com or Dr. Dobbs' Journal articles, and these often point you towards outdated things.
  • search.cpan.org's search function puts modules which haven't been updated for ten years on page one, and the latest and greatest on page ten or something.

Beware of "hype":

One more thing I want to say: Be wary of advice on blogs, stackoverflow, Usenet news, etc. - people tend to guide you to whatever module happens to be flavour of the month, rather than a stable, proven solution. The "trendy" modules usually lack documentation, are unstable, have nightmarish dependencies, and quite often yesterday's fashionable modules suddenly fall out of favour and are abandoned, to be replaced by another flavour of the month, leaving you in the lurch if you decide to use them.

like image 191
Snake Plissken Avatar answered Nov 13 '22 14:11

Snake Plissken


Task::Kensho generally makes good recommendations. For sending email it suggests Email::Sender

like image 9
Quentin Avatar answered Nov 13 '22 14:11

Quentin


I'll throw in Email::Stuff. It's a nice wrapper for Email::MIME. You don't need to care about the MIME structure of the mail, the module does it for you.

Email::Stuff->from     ('[email protected]'                      )
            ->to       ('[email protected]'              )
            ->bcc      ('[email protected]'                )
            ->text_body($body                              )
            ->attach   (io('dead_bunbun_faked.gif')->all,
                        filename => 'dead_bunbun_proof.gif')
            ->send;

As for selecting modules,

like image 3
Thomas Kappler Avatar answered Nov 13 '22 15:11

Thomas Kappler