* EDAVIS via RT (bug-MailTools@rt.cpan.org) [080527 08:07]:
Show quoted text> Queue: MailTools
> Ticket <URL:
http://rt.cpan.org/Ticket/Display.html?id=36103 >
>
> perlfunc(1):
>
> > print Prints a string or a list of strings. Returns true if
> > successful.
>
> This implies that you should always check the return value of print,
> since it could fail and return false. (Unless you really don't care
> whether it succeeds or not.)
This return status indicates an error when the OS has signalled the
program that something is wrong with the file-handle. It does not
reflect whether the actual characters were written.
Characters are written into the output buffers, which are within your
program, until a buffer of 4 kB is full. Then, the stdio will transfer
it to kernel space. If something goes wrong there, the last print
will probably return an error.
However, once in the kernel, it is still not sure that the characters
will end-up on disk. The manual page of close explains it
NOTES
Not checking the return value of close is a common but nevertheless
serious programming error. It is quite possible that errors on a pre‐
vious write(2) operation are first reported at the final close. Not
checking the return value when closing the file may lead to silent loss
of data. This can especially be observed with NFS and with disk quota.
So: I suspect that checking the return value of print is giving you
unjustified feeling of additional protection. It doesn't help much,
and makes programs overly complicated.
The best sign that something is wrong you probably get from
Mail::Send/Mail::Mailer is a SIGPIPE from the OS. Don't ignore
SIGPIPE.
--
Regards,
MarkOv
------------------------------------------------------------------------
Mark Overmeer MSc MARKOV Solutions
Mark@Overmeer.net solutions@overmeer.net
http://Mark.Overmeer.net http://solutions.overmeer.net