Hello, to make my crawler a bit more robust, I tried to derive my own user agent. But my callback subroutine is never used (http protocol) and alarm return immediate, not after 60 seconds. It has to be my fault, but which? I can't see
Thanks Ulrich package CODY::ROBOT; use strict; use vars qw($VERSION @ISA); use LWP::UserAgent; use HTTP::Status; $VERSION = sprintf("%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/); @ISA = qw(LWP::UserAgent); sub new { my $class = shift; my $self = $class->SUPER::new(@_); $self->agent("CTR/$VERSION"); $self->from("info\@luna-park.de"); $self->timeout(30); return $self; } sub simple_request { my $self = shift; my $request = shift; return HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST) if ($request->uri()->scheme() =~ m/file/); my $response; eval { local $SIG{ALRM} = sub {die "CODY::ROBOT timeout";}; alarm(30); $response = $self->SUPER::simple_request($request, \&mycallback, 4096); alarm(0); }; if ($@) { # # timeout # $response = HTTP::Response->new(&HTTP::Status::RC_REQUEST_TIMEOUT) } return $response; } ###################################################### # # REQUEST CALLBACK # sub mycallback { my $content = shift; my $response = shift; my $protocol = shift; print "CALLBACK: $$content\n\n"; return; $response->add_content($$content); my $content_size = length($response->content()); if (($protocol->max_size() && $content_size > $protocol->max_size()) or ($content_size > 128*1024)) { CODY::Debug::debug("Aborting because size limit exceeded"); my $tot = $response->header("Content-Length") || 0; $response->header("X-Content-Range", "bytes 0-$content_size/$tot"); die "Aborting because size limit exceeded"; } } ###################################################### 1; -- Searchengine Know How - Webpromotion - Optimization - Internal Search World Wide Web Publisher, Ulrich Wisser, Odensvag 13, S-14571 Norsborg http://www.publisher.de Tel: +46-8-53460905 Fax: +46-8-534 609 06