develooper Front page | perl.module-authors | Postings from February 2005


Thread Next
Eric Wilhelm
February 28, 2005 20:52
Message ID:
Oh wise and potent module namers...

I have a module that uses Net::SMTP_auth and basically implements the 
following interface:

  # This assumes settings (such as mymail@mydomain)
  # are found in your ~/.mrmailer.conf (or /etc/...)
  my $mail = Mail::MrMailer->new()
  ... # productive stuff
  if($error) {
    # you'll be the only one to get this:
    $mail->maildie("error happened:  $error");
  # you'll get a bcc of this:
  $mail->send_msg({to => $recip, cc => $mail->var('boss')}, 
      "Everything is okay.",
      "I'm taking tomorrow off.", "",
      "--Eric", ""

This is really intended for cron and other fully-automatic 
(webserver/daemon triggered) jobs where you want mail to be sent via an 
external smtp server (and don't want to mess with sendmail.)  Because 
of the YAML config file support, you can define the owner's (your) 
address and smtp username/password info in a single place instead of in 
every script.

The usual questions apply:
  How useful is this?
  What should I name it?

I've looked at:
    too messy, no config-file support
    too full-service/procedural

I've also played with the idea of defining some signal handlers or other 
IO-magic which would allow you to send mail on a standard die() call or 
maybe use some kind of severity threshold to only send warnings which 
go above a given threshold.  (but maybe that's another module?)

Maybe it goes in IO::?

"It is a mistake to allow any mechanical object to realize that you are 
in a hurry." 
                                      -- Ralph's Observation

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About