SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

BotDetect - Real-Time Bot Detection API
 
 

MAN page from Other LWP.pm-5.48-2.i386.rpm

lib::LWP::Protocol

Section: User Contributed Perl Documentation (3)
Updated: libwww-perl-5.48
Index 

NAME

LWP::Protocol - Base class for LWP protocols 

SYNOPSIS

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

DESCRIPTION

This class is used a the base class for all protocol implementationssupported by the LWP library.

When creating an instance of this class usingLWP::Protocol::create($url), and you get an initialised subclassappropriate for that access method. In other words, theLWP::Protocol::create() function calls the constructor for one of itssubclasses.

All derived LWP::Protocol classes need to override the request()method which is used to service a request. The overridden method canmake use of the collect() function to collect together chunks of dataas it is received.

The following methods and functions are provided:

$prot = LWP::Protocol->new()
The LWP::Protocol constructor is inherited by subclasses. As this is avirtual base class this method should not be called directly.
$prot = LWP::Protocol::create($url)
Create an object of the class implementing the protocol to handle thegiven scheme. This is a function, not a method. It is more an objectfactory than a constructor. This is the function user agents shoulduse to access protocols.
$class = LWP::Protocol::implementor($scheme, [$class])
Get and/or set implementor class for a scheme. Returns `' if thespecified scheme is not supported.
$prot->request(...)

 $response = $protocol->request($request, $proxy, undef); $response = $protocol->request($request, $proxy, '/tmp/sss'); $response = $protocol->request($request, $proxy, \&callback, 1024);
Dispactches a request over the protocol, and returns a responseobject. This method needs to be overridden in subclasses. Referer tothe LWP::UserAgent manpage for description of the arguments.
$prot->timeout($seconds)
Get and set the timeout value in seconds
$prot->parse_head($yesno)
Should we initialize response headers from the <head> section of HTMLdocuments.
$prot->collect($arg, $response, $collector)
Called to collect the content of a request, and process itappropriately into a scalar, file, or by calling a callback. If $argis undefined, then the content is stored within the $response. If$arg is a simple scalar, then $arg is interpreted as a file name andthe content is written to this file. If $arg is a reference to aroutine, then content is passed to this routine.

The $collector is a routine that will be called and which isreponsible for returning pieces (as ref to scalar) of the content toprocess. The $collector signals EOF by returning a reference to anempty sting.

The return value from collect() is the $response object reference.

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

$prot->collect_once($arg, $response, $content)
Can be called when the whole response content is available as$content. This will invoke collect() with a collector callback thatreturns a reference to $content the first time and an empty string thenext.
 

SEE ALSO

Inspect the LWP/Protocol/file.pm and LWP/Protocol/http.pm filesfor examples of usage. 

COPYRIGHT

Copyright 1995-2000 Gisle Aas.

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


 

Index

NAME
SYNOPSIS
DESCRIPTION
SEE ALSO
COPYRIGHT

This document was created byman2html,using the manual pages.
 
ICM Bot detect detector