Mail::Sender allows you to log all conversation with the SMTP server into a file that will look somewhat like this:
This is implemented by replacing the $sender->{socket} with a tied filehandle that reads or writes from/to the original socket and dumps everything read/written into a log file/another filehandle. Which means that the rest of the module doesn't have to care whether the debuging is on or off.>> 220 ooa Microsoft ESMTP MAIL Service, Version: 5.0.2195.5329 ready +at Wed, 21 May 2003 14:11:18 -0600 << ehlo CZXXPRA01SV0007 >> 250-ooa Hello [xx.xx.xx.xx] >> 250-AUTH GSSAPI NTLM LOGIN >> 250-AUTH=LOGIN ... >> 250 OK << mail from: <jenda@krynicky.cz> >> 250 2.1.0 jenda@krynicky.cz....Sender OK << rcpt to: <jenda@krynicky.cz> >> 550 5.7.1 Unable to relay for jenda@krynicky.cz
Currently the code implementing this resides within Mail/Sender.pm (package Mail::Sender::DBIO) and only supports print(), readline()/<>, CLOSE() and opened(). Do you think it would be worth to move it to a separate module and add support for other filehandle methods?
If so how should I name the module? And what other filehandle methods should it support?
Update: I guess I did not express this clearly :-) I'm not asking whether it would be more efficient to put the code into a separate file or something. I'm asking whether it would be worth to give the code a life (and name) of its own. Whether it would be worth to unattach the code from Mail::Sender, make it more general and let others use it in their modules.
Jenda
Always code as if the guy who ends up maintaining your code
will be a violent psychopath who knows where you live.
-- Rick Osborne
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |