in reply to Net::LDAP in a CGI script

When I try putting in an IP address instead of a host name, I get

I assume you mean $host where you are putting the IP address, right?

If you check out IO::Socket::INET (just search for the file INET.pm in your perl install), you will see that the error message is not only printed for the PeerAddr, but also for the LocalAddr, i.e. the local hostname. To check if this is the cause you could change the Net::LDAP call to

my $ldap = new Net::LDAP($host, port => $port, localaddr => "yourhostn +ame");

If this doesn't help, you might add the following lines to the start of the sub configure in INET.pm to check out which values it gets when it is called

use Data::Dumper; open($f,'>','/tmp/log); print $f Data::Dumper($arg); close($f);

It probably will tell you where INET gets this '<hostname>' string from that it prints.

Replies are listed 'Best First'.
Re^2: Net::LDAP in a CGI script
by rhirst (Initiate) on Jan 26, 2010 at 09:43 UTC

    Thanks for the reply guys

    I did eventually get this working. For information, this was down to the environment. The "SYSTEMROOT" environment variable was not set, and this was required for the query to work correctly.

    Regards
    Rich