in reply to Re: Should I extract Mail::Sender's debuging into a separate module?
in thread Should I extract Mail::Sender's debuging into a separate module?

Well the code is compiled only if needed. It's in a here-doc string that gets eval()ed if necessary.

I could name it Mail::Sender::Logging or even just Mail::Sender::DBIO if I planed to use it only from Mail::Sender, but then I might just leave it inside Sender.pm. The real question is ... would someone else find this helpfull? I mean with a little trickery you might even be able to sneak such debuging to a module that has no debugging yet. You'd just have to extract the socket it contains somewhere inside and replace it with a handle tied to this class that would forward all reads/writes to the real socket:

use Some::Module; use Socket::Logger; #or whatever name it ends up with my $obj = Some::Module->new(parameters); $obj->{_socket} = Socket::Logger->new($obj->{_socket}, $logfilepath); ... use the $obj

It's a good idea about the subclassability, thanks for that.

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

Edit by castaway: Closed small tag in signature

  • Comment on Re: Re: Should I extract Mail::Sender's debuging into a separate module?
  • Download Code