Mike South > ParallelUserAgent-2.58 > LWP::Parallel::Protocol

Download:
ParallelUserAgent-2.58.tgz

Dependencies

Annotate this POD

CPAN RT

New  10
Open  1
View/Report Bugs
Module Version: 1.10   Source   Latest Release: ParallelUserAgent-2.61

NAME ^

LWP::Parallel::Protocol - Base class for parallel LWP protocols

SYNOPSIS ^

 package LWP::Parallel::Protocol::foo;
 require LWP::Parallel::Protocol;
 @ISA=qw(LWP::Parallel::Protocol);

DESCRIPTION ^

This class is used a the base class for all protocol implementations supported by the LWP::Parallel library. It mirrors the behavior of the original LWP::Parallel library by subclassing from it and adding a few subroutines of its own.

Please see the LWP::Protocol for more information about the usage of this module.

In addition to the inherited methods from LWP::Protocol, The following methods and functions are provided:

ADDITIONAL METHODS AND FUNCTIONS ^

$prot = LWP::Parallel::Protocol->new();

The LWP::Parallel::Protocol constructor is inherited by subclasses. As this is a virtual base class this method should not be called directly.

Note: This is inherited from LWP::Protocol

$prot = LWP::Parallel::Protocol::create($schema)

Create an object of the class implementing the protocol to handle the given scheme. This is a function, not a method. It is more an object factory than a constructor. This is the function user agents should use to access protocols.

$class = LWP::Parallel::Protocol::implementor($scheme, [$class])

Get and/or set implementor class for a scheme. Returns '' if the specified scheme is not supported.

$prot->receive ($arg, $response, $content)

Called to store a piece of content of a request, and process it appropriately into a scalar, file, or by calling a callback. If $arg is undefined, then the content is stored within the $response. If $arg is a simple scalar, then $arg is interpreted as a file name and the content is written to this file. If $arg is a reference to a routine, then content is passed to this routine.

$content must be a reference to a scalar holding the content that should be processed.

The return value from receive() is undef for errors, positive for non-zero content processed, 0 for forced EOFs, and potentially a negative command from a user-defined callback function.

Note: We will only use the file or callback argument if $response->is_success(). This avoids sendig content data for redirects and authentization responses to the file or the callback function.

$prot->receive_once($arg, $response, $content, $entry)

Can be called when the whole response content is available as $content. This will invoke receive() with a collector callback that returns a reference to $content the first time and an empty string the next.

SEE ALSO ^

Inspect the LWP/Parallel/Protocol/http.pm file for examples of usage.

COPYRIGHT ^

Copyright 1997-2004 Marc Langheinrich <marclang@cpan.org> Parts copyright 1995-2004 Gisle Aas

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

syntax highlighting: