in reply to replacement for LWP::Simple ?

I run script
#!/usr/local/bin/perl -w use lib '.'; use LWP::Simple; $myDocument = get "http://www.ecst.csuchico.edu/"; print "Content-type: text/html\n\n"; $myDocument;
still error message appears:
Useless use of a variable in void context at /docs/cust-bin/test.cgi l +ine 8. Content-type: text/html
so there is an error while processing --> $myDocument;

Jacek

Replies are listed 'Best First'.
Re: Re: replacement for LWP::Simple ?
by Util (Priest) on May 14, 2002 at 18:22 UTC
    Correct! I was asserting that you had tested this:
    print "Content-type: text/html\n\n"; $myDocument;
    but posted this:
    print "Content-type: text/html\n\n", $myDocument;

    A comma would mean that $myDocument is the second argument to the print statement, and should work. A semi-colon would mean that $myDocument was a statement in itself, which is nonsensical, and will give you the error message you posted.

    I think that you actually tested using a semi-colon twice, and happened to mis-key the semi-colon when you posted the first time, changing it into a comma and fixing your own problem! (Or maybe larsen fixed your error, and you cut-and-pasted his correction ?)

    Can you test your program again, making sure you have only a comma between "Content-type: text/html\n\n" and $myDocument ?