Installing LWP


 
Network Programming with Perl
By Lincoln  D.  Stein
Slots : 1
Table of Contents
Chapter  9.   Web Clients

    Content

The first version of LWP appeared in 1995, and was written by Martijn Koster and Gisle Aas. It has since been maintained and extended by Gisle Aas, with help from many contributors.

The basic LWP library, distributed via CPAN in the file libwww-X.XX.tar.gz (where X.XX is the most recent version number), provides supports for the HTTP, FTP, Gopher, SMTP, NNTP, and HTTPS (HTTP over Secure Sockets Layer) protocols. However, before you can install it, you must install a number of prerequisite modules:

URI

URL parsing and manipulation

Net::FTP

to support ftp://URLs

MIME::Base64

to support HTTP Basic authentication

Digest::MD5

to support HTTP Digest authentication

HTML::HeadParser

for finding the <BASE> tag in HTML headers

You could download and install each of these modules separately, but the easiest way is to install LWP and all its prerequisites in batch mode using the standard CPAN module. Here is how to do this from the command line:

 %  perl -MCPAN -e 'install Bundle::LWP'  

This loads the CPAN module and then calls the install() function to download, build, and install LWP and all the ancillary modules that it needs to run.

The HTML-parsing and HTML-formatting modules were once bundled with LWP, but are now distributed as separate packages named HTML-Parser and HTML-Formatter, respectively. They each have a number of prerequisites, and again, the easiest way to install them is via the CPAN module using this command:

 %  perl -CPAN -e 'install HTML::Parser' -e 'install HTML::Formatter'  

If you want to install these libraries manually, here is the list of the packages that you need to download and install:

HTML-Parser

HTML parsing

HTML-Tree

HTML syntax-tree generation

Font-AFM

Postscript font metrics

HTML-Format

HTML formatting

To use the HTTPS (secure HTTP) protocol, you must install one of the Perl SSL modules, IO::Socket::SSL, as well as OpenSSL, the open source SSL library that IO::Socket::SSL depends on. OpenSSL is available from http://www.openssl.org/.

LWP is pure Perl. You don't need a C compiler to install it. In addition to the module files, when you install LWP you get four scripts, which serve as examples of how to use the library, as well as useful utilities in their own right. The scripts are:

  • lwp-request Fetch a URL and display it.

  • lwp-download Download a document to disk, suitable for files too large to hold in memory.

  • lwp-mirror Mirror a document on a remote server, updating only the local copy if the remote one is more recent.

  • lwp-rget Copy an entire document hierarchy recursively.


   
Top


Network Programming with Perl
Network Programming with Perl
ISBN: 0201615711
EAN: 2147483647
Year: 2000
Pages: 173

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net