sub send { my ($class, $message, @args) = @_; my $mailer = $class->_find_sendmail; return failure "Couldn't find 'sendmail' executable in your PATH" ." and \$".__PACKAGE__."::SENDMAIL is not set" unless $mailer; return failure "Found $mailer but cannot execute it" unless -x $mailer; local $SIG{'CHLD'} = 'DEFAULT'; my $pipe = gensym; ### print "| $mailer -t -oi @args"; open $pipe, "| $mailer -t -oi @args" or return failure "Error executing $mailer: $!"; print $pipe $message->as_string or return failure "Error printing via pipe to $mailer: $!"; close $pipe or return failure "error when closing pipe to $mailer: $!"; return success; }