in reply to Re^3: LWP::Simple Empty File
in thread LWP::Simple Empty File

Nothing is printed when I run the test above. I do notice that there is a very slight lag before it goes back to the command prompt. Anything else I should try?

Replies are listed 'Best First'.
Re^5: LWP::Simple Empty File
by Marshall (Canon) on Mar 04, 2012 at 17:43 UTC
    Odd. Let's make sure we are talking about the same thing.
    Save the program as for example: testLWP.pl
    From the command line type: perl testLWP.pl
    I am thinking that something is wrong in your Windows Perl environment.
    There are some "tricks" about this - related to file associations.
    Invoke Perl explicitly in the command line "perl testLWP.pl".

    In theory, we should be able to figure out why this code (3 lines) is not running on your machine.
    I think something is wrong that is unrelated to LWP.

    Forgive me for asking this, but can you run "helloWorld.pl"?

    #!/usr/bin/perl -w use strict; print "Hello World!!\n";

      Just ran the hello world code and it worked fine. Thanks for all your help. I do save files as .pl and then invoke "perl file.pl" in the command prompt.

        Well, I am sorry that I couldn't be of more help.
        I am just flabbergasted as to how this code not only fails to get the web page $content on your machine, but winds up with a null string for $content instead of an undef value.
        #!/usr/bin/perl -w use strict; use LWP::Simple; $|=1; #turn off buffering so we see all the lines print "starting...get...\n"; my $content = get("http://perlmonks.org/?node_id=957704"); die "blank content" unless defined $content; print "ending...get...\n"; print $content; print "END of CONTENT\n";
        The above code runs on my machine. This is bizarre.

        I guess now we come down to the very improbable...how did you install LWP::Simple on your Windows machine?