develooper Front page | perl.libwww | Postings from December 2002

Re: Why doesn't this script work?

Thread Previous | Thread Next
Michael A Chase
December 30, 2002 20:35
Re: Why doesn't this script work?
Message ID:
On Mon, 30 Dec 2002 09:40:31 +0200 Octavian Rasnita <> wrote:

> I've tried to run the following script from command line under Windows and
> it works fine, but if I run it from Internet Explorer, the page doesn't
> print anything and it is still "Opening page...".

??? How can Internet Explorer execute a Perl script?  At most it can
request a URL from a webserver which in turn runs the script.

> Can you tell me what could be the problem with it?
> Thank you. Here is the script:
> #!/perl/bin/perl -w
> use strict;
> use LWP::UserAgent;
> my $ua = LWP::UserAgent -> new(env_proxy => 0,
> timeout => 30,
> keep_alive => 1,
> );
> my $request = HTTP::Request -> new('GET', 'http://localhost/');
> my $response = $ua -> request($request);
> my $content = $response -> content();
> print "Content-type: text/html\n\n";
> print $content;

MSIE is a UserAgent, so is this script.  Neither can invoke the other.  It
looks like this script is meant to be called by a webserver for a URL
request which MSIE or any other browser or LWP script can submit.

If you are now wondering why the webserver isn't returning what you expect,
you need to look in the webserver's logs.  It's usually a problem of file
permissions or environment variables not being appropriate for the account
the webserver is running in.

Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter:
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About