Subject: | [patch] make debug output conditional |
During test run, Net::LDAP::Server::Test prints a message for starting the
server, a client connecting and server shutdown cluttering test output. Since it
already uses $ENV{LDAP_DEBUG} as conditional for test output, the
attached patch extends this to all messages.
Subject: | debug_output_conditional.diff |
commit 3e36681266dbde9cf9ba969136341d2864ae36af
Author: Stefan Seifert <nine@detonation.org>
Date: Thu Jan 26 14:20:04 2012 +0100
Make debug output conditional on $ENV{LDAP_DEBUG}
diff --git a/lib/Net/LDAP/Server/Test.pm b/lib/Net/LDAP/Server/Test.pm
index a94dc69..596ef73 100644
--- a/lib/Net/LDAP/Server/Test.pm
+++ b/lib/Net/LDAP/Server/Test.pm
@@ -79,7 +79,7 @@ Only one user-level method is implemented: new().
sub new {
my ( $class, $sock, %args ) = @_;
my $self = $class->SUPER::new($sock);
- warn sprintf "Accepted connection from: %s\n", $sock->peerhost();
+ warn sprintf "Accepted connection from: %s\n", $sock->peerhost() if $ENV{LDAP_DEBUG};
$self->{_flags} = \%args;
return $self;
}
@@ -846,7 +846,7 @@ sub new {
}
elsif ( $pid == 0 ) {
- warn "Creating new LDAP server on port $port ... \n";
+ warn "Creating new LDAP server on port $port ... \n" if $ENV{LDAP_DEBUG};
# the child (server)
my $sock = IO::Socket::INET->new(
@@ -885,7 +885,7 @@ sub new {
# if there are no open connections,
# exit the child process.
if ( !keys %Handlers ) {
- warn " ... shutting down server\n";
+ warn " ... shutting down server\n" if $ENV{LDAP_DEBUG};
exit(0);
}
}