(post updated 06/20/2005 17:00)
I have a number of scripts that run automatically for me on my WinXP Pro box running ActiveSTate Perl 5.8.0 build 806. For the last serveral days these scripts have not been working for me.

My environment variables (i.e. http_proxy and such) have not been changed. I don't use a proxy.

So, I run them by hand. On a line like this:
my $doc = get URL;
my script locks up.

At a command line on the same box, I can type:
perl -S GET URL
where URL is the same as what is in the script. That works fine, presumably because GET.pl uses LWP::UserAgent.

Putting that assumption to the test, I wrote this small script:

#!perl # What's Wrong with LWP::Simple::get ? use strict; use LWP::UserAgent; use LWP::Simple; use constant URL => 'http://www.google.com'; main(); exit(0); sub main { print "Fetching '" . URL . "' with LWP::UserAgent\n"; my $ua = LWP::UserAgent->new(); my $response = $ua->get(URL); if ( $response->is_success ) { my $len = length($response->content); print "Retrieved $len bytes\n"; } else { my $code = $response->code; print "Failed to retrieve URL: $code\n"; } print "Fetching '" . URL . "' with LWP::Simple\n"; my $content = LWP::Simple::get( URL ); if ( $content ) { my $len = length($content); print "Retrieved $len bytes\n"; } else { print "Failed to retrieve URL\n"; } }

I can run this script on a *NIX box with no problem. On my WinXPPro box, however, the $ua->get() works but then it never gets past the LWP::Simple::get() call.

Note that the scripts that are now failing have not been modified in weeks, if not months.

So, this post is both a question for help and a poll to see if anyone else on WinXP is having similiar problems with their LWP::Simple::get functionality.

So, has anyone else seen a problem like this? If so, how do I fix it?


Update: After uninstalling/reinstalling ActiveState Perl, my LWP modules seem to be working fine. Honestly, I haven't modified my environment or Perl installation in over two weeks, so I really can't fathom what could have changed.

I appreciate everyone's feedback on this thread. I've learned a lot about the LWP modules and how to keep them happy :)

In reply to Why would LWP::Simple::get stop working? by dpmott

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.