terriblue has asked for the wisdom of the Perl Monks concerning the following question:

Hi there, I'm a new user with Perl and I'm trying to get a bioperl module to connect to a webpage to conduct a search and send back results. Using the remoteblast.pm module on my laptop at work, I get the following error message:
    500 Can't connect to www.site.com (Bad protocol 'tcp')
Using the module on a linux beowolf cluster, I get the message:
    500 Can't connect to www.site.com (Bad host name 'www.site.com')
I think the first error is due to problems with our firewall, does this sound resonable to assume? As for the second error, do you think it is because I have an environment variable incorrectly set? Any ideas are welcome, even if it's just to say I SOUND like a novice.... : )
    thanks!

Replies are listed 'Best First'.
Re: Problem using Perl to access a webpage
by mutated (Monk) on Mar 04, 2004 at 20:17 UTC
    500 Can't connect to www.site.com (Bad protocol 'tcp')

    Do you have a proxy server at your office? this sounds like your firewall might be blocking the http connection, check the web browser configuration on a machine on that network that works and look to see if a proxy server is configured...
    500 Can't connect to www.site.com (Bad host name 'www.site.com')

    Sounds like no DNS...are you trying to use it on one of your bewolf nodes or on your beowolf controller? If it's setup like I've set up my cluster, the nodes are all on a private network with 0 outside access, which would explain why it can't resolve the name..if you absolutely need this script to run on the beowolf nodes I would suggest setting up your beowolf controller as a chaching DNS server and using it to serve up DNS to all the dumby nodes..


    daN.
Re: Problem using Perl to access a webpage
by iburrell (Chaplain) on Mar 04, 2004 at 21:23 UTC
    Check if networking is working on the machine and with Perl. The first error, "Bad protocol 'tcp'", only happens when it can't find the info on the TCP protocol. The second happens when it can't lookup the hostname.

    Can you connect outside of Perl? Can you use "lwp-request" command to perform HTTP?

Re: Problem using Perl to access a webpage
by kutsu (Priest) on Mar 04, 2004 at 20:34 UTC

    Have you tried CGI::Carp to see if you get a better error message.

    use CGI::Carp qw(fatalsToBrowser); #remove for production die "Fatal error messages are now sent to browser";

    "Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce

Re: Problem using Perl to access a webpage
by blue_cowdawg (Monsignor) on Mar 04, 2004 at 19:48 UTC

        500 Can't connect to www.site.com (Bad protocol 'tcp')

    At first blush "500" is usually a configuration error on the server OR a badly written (broken) CGI script. What-cha got for code?


    Peter L. Berghold -- Unix Professional
    Peter at Berghold dot Net
       Dog trainer, dog agility exhibitor, brewer of fine Belgian style ales. Happiness is a warm, tired, contented dog curled up at your side and a good Belgian ale in your chalice.
      LWP will return a 500 status code when it can't connect to the server. From a web server, it indicates a problem on the server, usually a CGI script dying. With LWP, it can indicate a network connection problem. In this case, this is what is happening.

      I would suggest that this is a bug in LWP::UserAgent. It should instead choose another code, or not return a code at all. This behavior can be turned with the use_eval option.

      More likely the latter. I tried CGI::Carp to get more information. Working on cleaning it up now...
Re: Problem using Perl to access a webpage
by smackdab (Pilgrim) on Mar 05, 2004 at 00:41 UTC
    I recently had this problem with WWW::Mechanize, which I understand to be derived from LWP::UserAgent (one of the other posters mentioned LWP...)

    For me, it always works in the browser and failes in LWP...

    Not even sure if this is even remotely helpful, but maybe it will spark an idea...Here is what the packet trace said:(I will be posting to a perl newsgroup later, so if I get an answer I'll post it back here)

    src: tcp connect, flag = sync dst: flag = ack, flag = reset src: flag = sync dst: flag = ack, flag = reset src: flag = sync dst: flag = ack, flag = reset <THAT'S IT>