SV wrote:
>Hi folks!
>
>I've encounter a strange problem using LWP with Apache 1.3.27 with
>mod_perl 1.27_01 installed on win2000pro box using Perl 5.6.1.
>
>I'm requesting content from some urls from localhost via looping an array.
>Everything fine with command line -c checking. Ever non-Apache server
>Xitami executes my script fine. But under Apache it strictly waits 180
>sec after each request. I've try it under Linux (our production box) (ASP Linux 7.0)
>Apache 1.3.27, Perl 5.6.1 without mod_perl and all works fine. May be mod_perl
>interprets LWP in particular way?
>
>Please, help!
>
>Here it is sample of my script:
>#!/usr/bin/perl -wT
>
>use strict;
>use warnings;
>use LWP;
>
>    my @location = (
>'http://localhost/foo.bar',
>'http://localhost/bar.foo',
>);
>
>my $agent = new LWP::UserAgent;
>
>#  $agent->timeout(30);
>my @data_stash;
>while (my $url = pop @location)
>{
>  my $req = new HTTP::Request(GET => $url );
>  my $result = $agent->request( $req );
>#after this Perl wait 180 sec as a timeout and after this process next
>#request. Here I try to set a lower timeout value but it warns with
>#error 500.
>  my $content = $result->content;
>  push @data_stash, [($url,$content)];
>}
>
>
>-- 
>Best regards,
> Serg Velikanov                          mailto:[EMAIL PROTECTED]

Ok, I have W2K, Perl 5.6.1.633 and Apache 2.0.40.
And I dont have files [foo.bar] and [bar.foo].
I tried that:

#!/usr/bin/perl -w

use strict;
use warnings;
use LWP;

my @location = ('http://localhost/foo.bar','http://localhost/bar.foo');

my $agent = new LWP::UserAgent;

#  $agent->timeout(30);
my @data_stash;
while (my $url = pop @location)
{
        my $req = new HTTP::Request(GET => $url );
        my $result = $agent->request( $req );
        my $content = $result->content;
        push(@data_stash,($url,$content));
}

print "\nResult:\n";
foreach my $tmp (@data_stash) {
        print " $tmp\n";
}
### END ###

Has received result instantly:

Result:
 http://localhost/bar.foo
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /bar.foo was not found on this server.</p>
<hr />
<address>Apache/2.0.40 Server at <a href="mailto:admin@local";>localhost</a> Port
 80</address>
</body></html>

 http://localhost/foo.bar
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /foo.bar was not found on this server.</p>
<hr />
<address>Apache/2.0.40 Server at <a href="mailto:admin@local";>localhost</a> Port
 80</address>
</body></html>

If to remove lines with a conclusion of the received data then the mistake 500 comes 
back.


- - - - - - -
Best  regards
      AlexBel


_____________________________________________________________
Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year.
http://login.mail.lycos.com/brandPage.shtml?pageId=plus&ref=lmtplus
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to