in reply to LWP::UserAgent always complains about Hostname

Maybe there's something wrong with your %Net::Config::NetConfig or you have defined a proxy that doesn't work properly?
$ perl -MNet::Config=%NetConfig -MData::Dumper -e 'print Dumper(\%NetC +onfig)' $ env | grep proxy

Replies are listed 'Best First'.
Re^2: LWP::UserAgent always complains about Hostname
by Herkum (Parson) on Jul 19, 2008 at 16:09 UTC

    I ran your script and got this back.

    $VAR1 = { 'pop3_hosts' => [], 'ftp_firewall' => undef, 'ph_hosts' => [], 'inet_domain' => undef, 'time_hosts' => [], 'daytime_hosts' => [], 'smtp_hosts' => [], 'test_exist' => 1, 'test_hosts' => 1, 'nntp_hosts' => [], 'ftp_ext_passive' => 1, 'snpp_hosts' => [], 'ftp_testhost' => undef, 'ftp_int_passive' => 0 };

    Most of those options, at least to me, seem non-critical for DNS resolution. As for the proxy variables, there no variables set and I am not using a proxy server either.

      Okay, then... Can you try this?

      $ strace -o 698729.out -econnect,sendto,recvfrom perl 698729.pl

      The 698729.out file should start with something similar to this:

      connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 + ENOENT (No such file or directory) connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 + ENOENT (No such file or directory) connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr( +"192.168.1.1")}, 28) = 0 sendto(3, "\321\263\1\0\0\1\0\0\0\0\0\0\2my\5yahoo\3com\0\0\1\0\1"..., + 30, MSG_NOSIGNAL, NULL, 0) = 30 recvfrom(3, "\321\263\201\200\0\1\0\2\0\0\0\0\2my\5yahoo\3com\0\0\1".. +., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_add +r("192.168.1.1")}, [16]) = 80 connect(3, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr( +"216.252.123.25")}, 16) = -1 EINPROGRESS (Operation now in progress) connect(3, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr( +"216.252.123.25")}, 16) = 0 ...

      Note that 192.168.1.1 is my DNS nameserver and I don't have nscd running, so the fist ENOENT errors can be ignored. You can see that the DNS query got through since 216.252.123.25 is the IP address for my.yahoo.com and there's a connection to port 80 going on.

      Hope that helps.

      Update: renamed lwp-useragent.pl to OP's node ID, so it's clear where does the code come from.

        Where did the lwp-useragent.pl script come from? I did not see it in the distribution.