Subject: | Feature Request: Implement a Debug option |
Date: | Fri, 14 Oct 2011 14:32:56 -0700 |
To: | bug-Net-SMTP-TLS-ButMaintained [...] rt.cpan.org |
From: | David Seleno <dave [...] seleno.net> |
Please implement these changes to allow passing a "Debug" flag in mailer_args when creating the mailer. This will allow debugging the SMTP transaction easily.
perl -v
This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi
$Net::SMTP::TLS::ButMaintained::VERSION = '0.18';
sub _response {
my $me = shift;
my $line = $me->{sock}->getline();
print STDERR ">>> $line" if ($me->{Debug}) ;
my @rsp = ( $line =~ /(\d+)(.)([^\r]*)/ );
# reverse things so the seperator is at the end...
# that way we don't have to get fancy with the return
# values for calls that don't require the "more indicator"
return ( $rsp[0], $rsp[2], $rsp[1] );
}
sub _command {
my $me = shift;
my $command = shift;
print STDERR "<<< $command\n" if ($me->{Debug}) ;
$me->{sock}->printf( $command . "\015\012" );
}