Greets Monks,
I'm fairly sure this isn't a perl problem per-se, but more of a configuration issue, so please don't flame me, as I'm sure one of you might have seen this before, or can tell me how to track it down
I'm running a little LWP script as cgi. It works when run from the command line, but dies when run as cgi with:
LWP result: {500 Can't connect to www.yahoo.com:80 (Bad hostname 'www.yahoo.com')}
#!/usr/bin/perl use LWP::Debug qw(level); level('+'); use LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); my $resp = $ua->get("http://www.yahoo.com/"); my $resultUsingLWP; if($resp->is_success) { $resultUsingLWP = $resp->content; } else { $resultUsingLWP = $resp->status_line; } print "Content-type: text/html; charset=utf-8\n\n"; print "LWP result: {$resultUsingLWP}"; print "\n";

I'm currently thinking it could be the paths which are:
root (command line): /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
apache (cgi): /usr/bin:/bin
however, as all other cgi rograms work fine, is there something in LWP that needs access to one of these directories?

In reply to LWP running as cgi by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.