Awesome Perl projects PT. 1

I hope to showcase and talk about a great Perl project every once in a while. Hope this lasts beyond one post. :)

We recently added emailing capabilities to an in-house application. Unfortunately sending the emails adds roughly 1 minute to the runtime. I decided to take a gander at swaks and see how it's being done there.

Swaks (SMTP transaction tester) is a great application for all systems administrators. It takes the pain away from testing email setups. Instead of echo msg | mailx -n -t ... and thinking of whether it's heirloom mailx, mail, nail or which version of mail it is, or whether you're using sendmail or exim or qmail or postfix (and in comes the headache...) - you can just write swaks -t addr -f addr. You don't even need the from field, but it's just as easy to add.

Swaks saves you the trouble of tailing logs and instead just shows you everything that's going on in the transport. It's easy to work with and it supports a lot of other options: it works with piping, unix sockets, input/output files, attachments, TLS, authentication, supports 12 mail protocols (from SMTP to LMTPSA), can work as a server(!) and much more!

Swaks is truly one of the most awesome Perl projects in any sysadmin book. Let's look at the core.

The good parts:

  • It uses strict!

  • It's divides to subroutines (that make sense).

  • The code is documented.

  • The application is documented (in POD!).

  • Clear code, skimmable.

  • Relatively concise, compared to the amount of stuff it can do.

  • Well thought-out as an application.

  • I could not find a single bad thing about this program, only not-so-good stuff.

The not-so-good parts:

  • Old indirect style of creating objects.

  • No warnings.

  • I wish more modules would be used to remove a lot of the code handling cmd opts.

  • (today using App::FatPacker this is no longer much of a problem)

Overall: This is an excellent project and something of which Perl should be proud, IMHO.

Leave a comment

About Sawyer X

user-pic Gots to do the bloggingz