in reply to LWP::UserAgent always complains about Hostname

You might single-step through that http.t with the perl debugger to find out how it knows that yours is a misconfigured system

IMHO easier would be to install perl 10.0 in /usr/local and try your script with that. If you do that, you find out whether ubuntu or perl5.8.8 is the culprit. While installing LWP::UserAgent you also find out on which non-core modules UserAgent is based and maybe some of them sound like they provide name services. Any likely candidates can then be reinstalled in your perl5.8.8 installation.

Just be careful with CPAN and both perl version. While different perl version have no problem coexisting on one machine it seems to me that cpan is using only one .cpan directory and can't cope with supplying more than one perl version. It might be better to create a second account just for using cpan with perl10.0 and leaving the old account strictly cpan with perl5.8.8

You might also use tcpdump to monitor whether there is any communication over the network when your script is called. Check the logfiles. Check /etc/nsswitch.conf and /etc/resolv.conf for sane values.

  • Comment on Re: LWP::UserAgent always complains about Hostname

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

    install perl 10.0

    find out on which non-core modules UserAgent is based

    These two things I can look into. They should not be that hard, at least compared with moving to a new system.

      Hi, I'm sure you must have already sorted out this issue by this time. But I just wanted to share my problem too here, so others can have this information. Also, please share your solution on this issue. I had the similar issue with LWP.UserAgent complaining "bad hostname" for whatever the host we give irrespective of the proxy url setup on the agent. All the hosts works just fine when we access them in the browser. We get response to nslookup and ping for all the hosts. Strange thing is that (my script) same script worked just fine when I tried with v5.8.8 and tomcat apache on solaris. But the same script fails when I use ActivePerl on windows xp. I tried to google for the solution and possible causes of this issue, but no luck :( My solution: I tried the same script in one of my friend's desktop where he was using apache instead of tomcat apache with the same ActivePerl. It just worked fine. So, I too ended up in installing and using apache instead of tomcat apace which worked well for me too. If somebody has more information on this issue and a resolution for this, please share! Thanks A PERL newbie!