# The following was supposedly scribed by
# Eric Wilhelm
# on Monday 21 March 2005 06:02 pm:

>The code is in my subversion repository, synopsis below for
> convenience.
>
>�
> http://ericwilhelm.homeip.net/svn/File-Backup-Config/trunk/code/perl/
>lib/IO/Mail.pm

Wow.  Ditching the tied filehandle and switching to open($handle, '>', 
\$scalar) does wonders for my sanity.

  
http://ericwilhelm.homeip.net/svn/File-Backup-Config/branches/IO-Mail-scalar-branch/code/perl/lib/IO/

Haven't tried to go back to the destructor-based send process.  I ran 
into trouble with IPC::Run because I hadn't implemented the full 
interface for the tied handles.  Anyway, the object wasn't really a 
tied handle.  Rather, the point was to make writing mail as simple as 
printing to the console.  So, for instance you might have this 
construct.

my $mail;
if($mailto) {
  $mail = IO::Mail->output();
  $mail->headers(
    To => $mailto,
    Subject => "incoming files",
    );
}
...
print "$num files in $time seconds\n";
...
$mail and ($mail->send());

--Eric
-- 
"Politics is not a bad profession. If you succeed there are many 
rewards, if you disgrace yourself you can always write a book." 
                                            -- Ronald Reagan
---------------------------------------------
    http://scratchcomputing.com
---------------------------------------------

Reply via email to