ParallelUserAgent

 view release on metacpan or  search on metacpan

lib/LWP/Parallel/UserAgent.pm  view on Meta::CPAN

	$scheme = $url->scheme;
    }
    my $protocol;
    eval {
	# add Parallel extension here
	$protocol = LWP::Parallel::Protocol::create($scheme);
    };
    if ($@) {
        # remove file/line number
	# $@ =~ s/\s+at\s+\S+\s+line\s+\d+.*//s;  
	return LWP::UserAgent::_new_response($request, &HTTP::Status::RC_NOT_IMPLEMENTED, $@)
    }

    # Extract fields that will be used below
    my ($agent, $from, $timeout, $cookie_jar,
        $use_eval, $parse_head, $max_size, $nonblock) =
      @{$self}{qw(agent from timeout cookie_jar
                  use_eval parse_head max_size nonblock)};

    # Set User-Agent and From headers if they are defined
    $request->init_header('User-Agent' => $agent) if $agent;
    $request->init_header('From' => $from) if $from;
    $request->init_header('Range' => "bytes=0-$max_size") if $max_size;
    $cookie_jar->add_cookie_header($request) if $cookie_jar;

    # Transfer some attributes to the protocol object
    $protocol->can('parse_head') ?
   $protocol->parse_head($parse_head) :
   $protocol->_elem('parse_head', $parse_head);
    $protocol->max_size($max_size);

    LWP::Debug::trace ("<- (undef".
		       ", ". (defined $proxy ? $proxy : '[undef]').
		       ", ". (defined $protocol ? $protocol : '[undef]').
		       ", ". (defined $timeout ? $timeout : '[undef]').
		       ", ". (defined $use_eval ? $use_eval : '[undef]').")");

    (undef, $proxy, $protocol, $timeout, $use_eval, $nonblock);
}

=head1 ADDITIONAL METHODS

=item $ua->use_alarm([$boolean])

This function is not in use anymore and will display a warning when 
called and warnings are enabled.

=cut

sub use_alarm {
    warn "The Parallel::UserAgent->use_alarm method is not available anymore.\n" if $^W;
}

=head1 Callback functions

You can register a callback function. See LWP::UserAgent for details.

=head1 BUGS

Probably lots! This was meant only as an interim release until this
functionality is incorporated into LWPng, the next generation libwww
module (though it has been this way for over 2 years now!)

Needs a lot more documentation on how callbacks work!

=head1 SEE ALSO

L<LWP::UserAgent>

=head1 COPYRIGHT

Copyright 1997-2004 Marc Langheinrich E<lt>marclang@cpan.org>

This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

=cut

__END__



( run in 1.306 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )