Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

lwp::protocol(3) [centos man page]

LWP::Protocol(3)					User Contributed Perl Documentation					  LWP::Protocol(3)

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 implementations supported by the LWP library. When creating an instance of this class using "LWP::Protocol::create($url)", and you get an initialised subclass appropriate for that access method. In other words, the LWP::Protocol::create() function calls the constructor for one of its subclasses. All derived LWP::Protocol classes need to override the request() method which is used to service a request. The overridden method can make use of the collect() function to collect together chunks of data as 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 a virtual base class this method should not be called directly. $prot = LWP::Protocol::create($scheme) 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::Protocol::implementor($scheme, [$class]) Get and/or set implementor class for a scheme. Returns '' if the specified 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); Dispatches a request over the protocol, and returns a response object. This method needs to be overridden in subclasses. Refer to LWP::UserAgent for description of the arguments. $prot->collect($arg, $response, $collector) Called to collect the 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. The $collector is a routine that will be called and which is responsible for returning pieces (as ref to scalar) of the content to process. The $collector signals EOF by returning a reference to an empty 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 sending content data for redirects and authentication responses to the callback which would be confusing. $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 that returns a reference to $content the first time and an empty string the next. SEE ALSO
Inspect the LWP/Protocol/file.pm and LWP/Protocol/http.pm files for examples of usage. COPYRIGHT
Copyright 1995-2001 Gisle Aas. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.3 2012-01-14 LWP::Protocol(3)

Check Out this Related Man Page

LWP::Protocol::ldap(3)					User Contributed Perl Documentation				    LWP::Protocol::ldap(3)

NAME
LWP::Protocol::ldap - Provide LDAP support for LWP::UserAgent SYNOPSIS
use LWP::UserAgent; $ua = LWP::UserAgent->new(); $res = $ua->get('ldap://ldap.example.com/' . 'o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)', Accept => 'text/json'): DESCRIPTION
The LWP::Protocol::ldap module provides support for using ldap schemed URLs following RFC 4516 with LWP. This module is a plug-in to the LWP protocol handling, so you don't use it directly. In addition to being used with LDAP URIs, LWP::Protocol::ldap also acts as the base class for its sibling modules LWP::Protocol::ldaps and LWP::Protocol::ldapi. Features HTTP methods supported LWP::Protocol::ldap implements the HTTP GET and HEAD methods. They are mapped to the LDAP search operation, Response format Depending on the HTTP Accept header provided by the user agent, LWP::Protocol::ldap can answer the requests in one of the following formats: DSML When the HTTP Accept header contains the "text/dsml" MIME type, the response is sent as DSMLv1. JSON When the HTTP Accept header contains the "text/json" MIME type, the response is sent as JSON. For this to work the JSON Perl module needs to be installed. LDIF When the HTTP Accept header contains the "text/ldif" MIME type, the response is sent in LDIFv1 format. HTML In case no HTTP Accept header has been sent or none of the above MIME types can be detected, and the x-format extension has not been provided either, the response is sent using HTML markup in a 2-column table format (roughly modeled on LDIF). As an alternative to sending an HTTP Accept header, LWP::Protocol::ldap also accepts the "x-format" extension Example: ldap://ldap.example.com/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)?x-format=dsml TLS support For ldap and ldapi URIs, the module implements the "x-tls" extension that switches the LDAP connection to TLS using a call of the start_tls method. Example: ldap://ldap.example.com/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)?x-tls=1 Note: In the above example, ideally giving "x-tls" should be sufficient, but unfortunately the parser in URI::ldap has a little flaw. Authorization Usually the connection is done anonymously, but if the HTTP Authorization header is provided with credentials for HTTP Basic authorization, the credentials given in that header will be used to do a simple bind to the LDAP server. SEE ALSO
LWP::Protocol::ldaps, LWP::Protocol::ldapi COPYRIGHT
Copyright (c) 1998-2004 Graham Barr, 2012 Peter Marschall. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2013-12-23 LWP::Protocol::ldap(3)
Man Page