As you may already know, the Comprehensive Perl Archive
Network (CPAN) has a bunch of ready-made Perl modules to enable developers to
efficiently perform common tasks. This is particularly true of CPAN’s network programming category, which has thousands of
Perl modules ranging from general (server daemons) to highly-specific
applications (interacting with a Cisco router). Since network programming is
one of the areas most developers find potentially troublesome, it’s worthwhile
spending some time browsing this collection to see if you can locate something
that will help you in your next project.

By listing ten of CPAN’s most
interesting modules in this category (Table
A
), this document provides a starting point for your journey through CPAN’s network programming section.

Note: You can install CPAN modules directly from the
Internet, by following the instructions provided at the CPAN Web site.

Table A

Package Name

Description

Net::Server

This module provides
routines to create a full-featured server that can be run either as a
single-connection server or through the *NIX inetd daemon. It supports
server features like multiplexing, forking, access control and transactions
on TCP, UDP and UNIX sockets, and can easily be extended through
sub-classing.

Use this
module when you need to create a highly-customized, extensible server for
specific requirements.

Net::POP3

This module provides routines to connect to and perform
transactions with a POP3 server through Perl. With this module, your Perl
application can authenticate, read and delete messages, or obtain message
listings using a pre-defined API.

Use this
module when you need to build a Perl-based POP3 email client.

LWP

This module provides an interface to creating HTTP clients
and servers. It provides an object-oriented interface to send HTTP requests
and decipher HTTP responses through Perl. It also supports proxies, cookies,
HTTP authentication and content negotiation, and redirection, all of which
come in handy when creating HTTP clients that transact with Web servers.

Use this
module when you need to build an HTTP client to interact with a Web server.

Net::Socket

This module provides an object-based interface to
creating, managing and destroying TCP/UDP sockets in the Perl environment.

Use this
module when you need an object-oriented interface for socket programming in a
TCP/IP environment.

Net::DNS

This module provides an interface to the DNS system,
allowing you to perform sophisticated DNS queries on a remote host through a
Perl application. The module also provides OOP access to different segments
of a DNS response.

Use this
module when you need to run DNS queries, like looking up nameservers
and MX records, or performing zone transfers.

Net::Packet

This module provides a low-level interface to creating and
transmitting network packets. You can use it to create different frame layers
and send the result out to a network.

Use this
module when you need to custom-create TCP, UDP, ICMP, IPv4 or IPv6 packets.

Net::Fileshare

This module provides an API to create file-sharing clients
and servers. Clients may be either interactive or automated.

Use this
module when you need to create a server to disseminate files, or an automated
download client.

Net::FTP

This module provides a wrapper around the FTP protocol,
making it possible to create an FTP client application in Perl. It supports
PASV transactions, ASCII and binary file transfers, and most common FTP file
operations on the remote server.

Use this
module when you need to perform an FTP file upload or download through your
Perl application.

Net::YMSG

This module provides an interface to the Yahoo! Messenger
instant-messaging service, allowing your Perl application to authenticate,
send and receive messages over the service.

Use this
module when you need a Perl-based interface to communicate with Yahoo!
Messenger users.

Net::SSH::Perl

This module provides a Perl interface to the SSH1 and SSH2
secure shell protocols. The module has built-in support for both password and
private-key authentication, performs automatic encryption of all data, and
can read an existing SSH configuration.

Use this module
when your Perl application needs to interface with an SSH-protected host.