start page | rating of books | rating of authors | reviews | copyrights

Book HomeJava and XSLTSearch this book

Chapter 8. Standard Modules

Contents:

AnyDBM_File
Attribute::Handlers
attributes
attrs
AutoLoader
AutoSplit
autouse
B
B::Asmdata
B::Assembler
B::Bblock
B::Bytecode
B::C
B::CC
B::Concise
B::Debug
B::Deparse
B::Disassembler
B::Lint
B::Showlex
B::Stackobj
B::Terse
B::Xref
base
Benchmark
bigint
bignum
bigrat
blib
bytes
ByteLoader
Carp
CGI
CGI::Apache
CGI::Carp
CGI::Cookie
CGI::Fast
CGI::Pretty
CGI::Push
CGI::Switch
charnames
Class::ISA
Class::Struct
Config
constant
CPAN
CPAN::FirstTime
CPAN::Nox
Cwd
Data::Dumper
DB
DB_File
Devel::DProf
Devel::PPPort
Devel::SelfStubber
diagnostics
Digest
Digest::MD5
DirHandle
Dumpvalue
DynaLoader
encoding
English
Env
Errno
Exporter
ExtUtils::Command
ExtUtils::Command::MM
ExtUtils::Constant
ExtUtils::Embed
ExtUtils::Install
ExtUtils::Installed
ExtUtils::Liblist
ExtUtils::MakeMaker
ExtUtils::Manifest
ExtUtils::Miniperl
ExtUtils::Mkbootstrap
ExtUtils::Mksymlists
ExtUtils::MM
ExtUtils::MM_Any
ExtUtils::MM_BeOS
ExtUtils::MM_DOS
ExtUtils::MM_NW5
ExtUtils::MM_OS2
ExtUtils::MM_Unix
ExtUtils::MM_UWIN
ExtUtils::MM_VMS
ExtUtils::MM_Win32
ExtUtils::MY
ExtUtils::Packlist
ExtUtils::testlib
Fatal
Fcntl
fields
File::Basename
File::CheckTree
File::Compare
File::Copy
File::DosGlob
File::Find
File::Path
File::Spec
File::Spec::Cygwin
File::Spec::Mac
File::Spec::OS2
File::Spec::Unix
File::Spec::VMS
File::Spec::Win32
File::stat
File::Temp
FileCache
FileHandle
Filter::Simple
Filter::Util::Call
FindBin
GDBM_File
Getopt::Long
Getopt::Std
Hash::Util
I18N::Collate
I18N::Langinfo
I18N::LangTags
I18N::LangTags::List
if
integer
IO
IO::File
IO::Handle
IO::Pipe
IO::Seekable
IO::Select
IO::Socket
IPC::Msg
IPC::Open2
IPC::Open3
IPC::Semaphore
IPC::SysV
less
lib
List::Util
locale
Math::BigFloat
Math::BigInt
Math::BigInt::Calc
Math::BigRat
Math::Complex
Math::Trig
MIME::Base64
MIME::QuotedPrint
NDBM_File
Net::Cmd
Net::Config
Net::Domain
Net::FTP
Net::hostent
Net::netent
Net::Netrc
Net::NNTP
Net::Ping
Net::POP3
Net::protoent
Net::servent
Net::SMTP
Net::Time
O
ODBM_File
Opcode
ops
overload
PerlIO
PerlIO::Scalar
PerlIO::Via
Pod::Functions
Pod::Html
Pod::ParseLink
Pod::Text
POSIX
re
Safe
Scalar::Util
SDBM_File
Search::Dict
SelectSaver
SelfLoader
Shell
sigtrap
Socket
sort
Storable
strict
subs
Switch
Symbol
Sys::Hostname
Sys::Syslog
Term::Cap
Term::Complete
Term::ReadLine
Test
Test::Builder
Test::Harness
Test::More
Test::Simple
Text::Abbrev
Text::Balanced
Text::ParseWords
Text::Soundex
Text::Tabs
Text::Wrap
Thread
Thread::Queue
Thread::Semaphore
Thread::Signal
Thread::Specific
Tie::Array, Tie::StdArray
Tie::File
Tie::Handle
Tie::Hash
Tie::Memoize
Tie::RefHash
Tie::Scalar
Tie::SubstrHash
Time::gmtime
Time::HiRes
Time::Local
Time::localtime
Time::tm
UNIVERSAL
User::grent
User::pwent
utf8
vars
vmsish
XS::Typemap

We've talked about the extent to which Perl benefits from user contributions. In fact, many contributed modules are so generally useful that they are now distributed with Perl itself. This chapter describes these "standard modules"; if you are running Perl 5.005, all these modules are already available to you. If you are running an earlier version of Perl, and you find that a module you want isn't on your system, or if you simply don't find what you need among the modules in this chapter, check CPAN for one that does what you want.

While this chapter primarily covers standard Perl modules called at execution time from your program, it also covers the "pragmatic" modules that affect the compilation phase. (A pragma is a compiler directive that provides hints to the compiler.) By convention, the names of the pragmatic modules are all lowercase, while the names of other modules begin with an uppercase letter and are of mixed case.

The Win32-specific modules are not included in this chapter, but are described in Chapter 19, "Lightweight Directory Access with Net::LDAP".

The following table provides a quick look at the standard modules and what they do:

Module

Function

AnyDBM_File

Provides framework for multiple DBMs

Attribute::Handlers

Simpler definition of attribute handlers (new in 5.8)

attributes

Sets or gets attributes of a subroutine

attrs

Sets or gets attributes of a subroutine (deprecated)

AutoLoader

Loads functions only on demand

AutoSplit

Splits a module for autoloading

autouse

Postpones loading modules until a function is used

B

Perl compiler and tools

base

Establishes IS-A relationship with base class at compile time

Benchmark

Checks and compares running times of code

bigint

Transparent big integer support for Perl (new in 5.8)

bignum

Transparent BigNumber support for Perl (new in 5.8)

bigrat

Transparent BigNumber/BigRational support for Perl (new in 5.8)

blib

Uses MakeMaker's uninstalled version of a package

bytes

Perl pragma to force byte semantics rather than character semantics

ByteLoader

Loads byte-compiled Perl code

Carp

Generates error messages

CGI

Simple Common Gateway Interface class

CGI::Apache

Sets up environment to use CGI with Perl-Apache API

CGI::Carp

CGI routines for writing to HTTPD (or other) error log

CGI::Cookie

CGI interface to Netscape (HTTP/1.1) cookies

CGI::Fast

CGI interface for FastCGI

CGI::Pretty

Module to produce nicely formatted HTML code

CGI::Push

Interface for server push operations

CGI::Switch

Tries multiple constructors and returns the first available CGI object

charnames

Defines character names for \N{named} string literal escape

Class::ISA

Reports the search path for a class's ISA tree (new in 5.8)

Class::Struct

Declares struct-like datatypes as Perl classes

Config

Accesses Perl configuration information

constant

Perl pragma to declare constants

CPAN

Queries, downloads, and builds Perl modules from CPAN sites

CPAN::FirstTime

Utility for CPAN::Config file initialization

CPAN::Nox

Wrapper around CPAN.pm without using any XS module

Cwd

Gets pathname of current working directory

Data::Dumper

Returns Perl data structures as strings

DB

Programmatic interface to the Perl debugging API

DB_File

Accesses Berkeley DB

Devel::DProf

Perl Code Profiler

Devel::PPPort

Module that assists with module porting between Perl versions

Devel::SelfStubber

Generates stubs for a self-loading module

diagnostics

Forces verbose warning diagnostics

Digest

Modules that calculate message digests (new in 5.8)

Digest::MD5

Perl interface to the MD5 Algorithm (new in 5.8)

DirHandle

Supplies object methods for directory handles

Dumpvalue

Provides a screen dump of Perl data

DynaLoader

Automatic dynamic loading of Perl modules

encoding

Allows you to write your script in nonasii or nonutf8 (new in 5.8)

English

Uses English or awk names for punctuation variables

Env

Imports environment variables

Errno

System errno constants from errno.h include file

Exporter

Default import method for modules

ExtUtils::Command

Utilities to replace common Unix commands

ExtUtils::Command::MM

Commands that the MM's can use in Makefiles (new in 5.8)

ExtUtils::Constant

Generates XS code to import C header constants (new in 5.8)

ExtUtils::Embed

Utilities for embedding Perl in C/C++ applications

ExtUtils::Install

Installs files from here to there

ExtUtils::Installed

Inventory management of installed modules

ExtUtils::Liblist

Determines libraries to use and how to use them

ExtUtils::MakeMaker

Creates a Makefile for a Perl extension

ExtUtils::Manifest

Utilities to write and check a MANIFEST file

ExtUtils::Miniperl

Writes the C code for perlmain.c

ExtUtils::Mkbootstrap

Makes a bootstrap file for use by DynaLoader

ExtUtils::Mksymlists

Writes linker option files for dynamic extension

ExtUtils::MM

Operating system-adjusted ExtUtils::MakeMaker subclass (new in 5.8)

ExtUtils::MM_Any

Platform-agnostic MM methods (new in 5.8)

ExtUtils::MM_BeOS

Methods that override UN*X behavior in ExtUtils::MakeMaker (new in 5.8)

ExtUtils::MM_DOS

DOS-specific subclass of ExtUtils::MM_Unix (new in 5.8)

ExtUtils::MM_NW5

Methods that override UN*X behavior in ExtUtils::MakeMaker (new in 5.8)

ExtUtils::MM_OS2

Methods to override Unix behavior in ExtUtils::MakeMaker

ExtUtils::MM_Unix

Methods used by ExtUtils::MakeMaker

ExtUtils::MM_UWIN

U/WIN-specific subclass of ExtUtils::MM_Unix (new in 5.8)

ExtUtils::MM_VMS

Methods to override Unix behavior in ExtUtils::MakeMaker

ExtUtils::MM_Win32

Methods to override Unix behavior in ExtUtils::MakeMaker

ExtUtils::MY

ExtUtils::MakeMaker subclass for customization (new in 5.8)

ExtUtils::Packlist

Manages .packlist files

ExtUtils::testlib

Adds blib/* directories to @INC

Fatal

Replaces functions with equivalents that succeed or die

Fcntl

Loads the C fcntl.h defines

fields

Perl pragma to provide compile time-verified class fields

File::Basename

Parses file specifications

File::CheckTree

Runs many tests on a collection of files

File::Compare

Compares files or filehandles

File::Copy

Copies files or filehandles

File::DosGlob

DOS-like globbing with enhancements

File::Find

Traverses a file tree

File::Path

Creates or removes a series of directories

File::Spec

Portably performs operations on filenames

File::Spec::Cygwin

Methods for Cygwin file specs (new in 5.8)

File::stat

By-name interface to Perl's built-in stat functions

File::Temp

Returns the name and handle of a temporary file safely

FileCache

Keeps more files open than the system permits

FileHandle

Supplies object methods for filehandles

Filter::Simple

Simplified source filtering (new in 5.8)

Filter::Util::Call

Perl Source Filter Utility Module (new in 5.8)

FindBin

Locates directory of original Perl script

GDBM_File

Tied access to GDBM library

Getopt::Long

Extended processing of command-line options

Getopt::Std

Processes single-character options with option clustering

Hash::Util

A selection of general utility hash subroutines (new in 5.8)

I18N::Collate

Compares 8-bit scalar data according to the current locale

I18N::Langinfo

Queries locale information (new in 5.8)

I18N::LangTags

Functions for dealing with RFC3066-style language tags (new in 5.8)

I18N::LangTags::List

Tags and names for human languages (new in 5.8)

if

Uses a Perl module if a condition holds (new in 5.8)

integer

Does arithmetic in integer instead of double

IO

Loads various I/O modules

IO::File

Supplies object methods for filehandles

IO::Handle

Supplies object methods for I/O handles

IO::Pipe

Supplies object methods for pipes

IO::Seekable

Supplies seek-based methods for I/O objects

IO::Select

Object-oriented interface to the select system call

IO::Socket

Object interface to socket communications

IPC::Msg

System V Msg IPC object class

IPC::Open2

Opens a process for both reading and writing

IPC::Open3

Opens a process for reading, writing, and error handling

IPC::Semaphore

System V Semaphore IPC object class

IPC::SysV

System V IPC constants

less

Perl pragma to request less of something from the compiler

lib

Manipulates @INC at compile time

List::Util

A selection of general utility list subroutines (new in 5.8)

locale

Perl pragma to use and avoid POSIX locales for built-in operations

Math::BigFloat

Arbitrary-length floating-point math package

Math::BigInt

Arbitrary-length integer math package

Math::BigInt::Calc

Pure Perl module to support Math::BigInt (new in 5.8)

Math::BigRat

Arbitrarily big rationals (new in 5.8)

Math::Complex

Complex numbers package

Math::Trig

Trigonometric functions

MIME::Base64

Encoding and decoding of base64 strings (new in 5.8)

MIME::QuotedPrint

Encoding and decoding of quoted, printable strings (new in 5.8)

NDBM_File

Tied access to NDBM files

Net::Cmd

Network Command class (new in 5.8)

Net::Config

Local configuration data for libnet (new in 5.8)

Net::Domain

Attempts to evaluate the current host's Internet name and domain (new in 5.8)

Net::FTP

FTP Client class (new in 5.8)

Net::hostent

By-name interface to Perl's built-in gethost* functions

Net::netent

By-name interface to Perl's built-in getnet* functions

Net::Netrc

OO interface to user's netrc file (new in 5.8)

Net::NNTP

NNTP Client class (new in 5.8)

Net::Ping

Checks whether a host is online

Net::POP3

Post Office Protocol 3 Client class (new in 5.8)

Net::protoent

By-name interface to Perl's built-in getproto* functions

Net::servent

By-name interface to Perl's built-in getserv* functions

Net::SMTP

Simple Mail Transfer Protocol Client class (new in 5.8)

Net::Time

Time and daytime network client interface (new in 5.8)

ODBM_File

Tied access to ODBM files

Opcode

Disables named opcodes when compiling Perl code

ops

Restricts unsafe operations when compiling

overload

Overloads Perl's mathematical operations

PerlIO

On-demand loader for PerlIO layers and root of PerlIO::* namespace (added in 5.8)

PerlIO::Scalar

Support module for in-memory I/O (new in 5.8)

PerlIO::Via

Helper class for PerlIO layers implemented in Perl (new in 5.8)

Pod::Functions

Used in converting from pod to HTML

Pod::Html

Module to convert pod files to HTML

Pod::ParseLink

Parses link-formatting code in POD documents (new in 5.8)

Pod::Text

Converts pod data to formatted ASCII text

POSIX

Perl interface to IEEE Std 1003.1

re

Perl pragma to alter regular expression behavior

Safe

Creates safe namespaces for evaluating Perl code

Scalar::Util

A selection of general-utility scalar subroutines (new in 5.8)

SDBM_File

Tied access to SDBM files

Search::Dict

Searches for key in dictionary file

SelectSaver

Saves and restores selected filehandle

SelfLoader

Loads functions only on demand

Shell

Runs shell commands transparently within Perl

sigtrap

Enables stack backtrace on unexpected signals

Socket

Loads the C socket.h defines and structure manipulators

sort

Perl pragma that controls sort behavior (new in 5.8)

Storable

Persistence for Perl data structures (new in 5.8)

strict

Restricts unsafe constructs

subs

Predeclares subroutine names

Switch

A switch statement for Perl (new in 5.8)

Symbol

Generates anonymous globs; qualifies variable names

Sys::Hostname

Tries every conceivable way to get hostname

Sys::Syslog

Perl interface to Unix syslog(3) calls

Term::Cap

Terminal capabilities interface

Term::Complete

Word completion module

Term::ReadLine

Interface to various ReadLine packages

Test

Framework for writing test scripts

Test::Builder

Backend for building text libraries (new in 5.8)

Test::Harness

Runs Perl standard test scripts with statistics

Test::More

Yet another framework for writing test scripts (new in 5.8)

Test::Simple

Basic utilities for writing tests (new in 5.8)

Text::Abbrev

Creates an abbreviation table from a list

Text::Balanced

Extracts delimited text sequences from strings (new in 5.8)

Text::ParseWords

Parses text into a list of tokens

Text::Soundex

The soundex algorithm described by Knuth

Text::Tabs

Expands and unexpands tabs

Text::Wrap

Wraps text into a paragraph

Thread

Multithreading support

Thread::Queue

Thread-safe queues

Thread::Semaphore

Thread-safe semaphores

Thread::Signal

Starts a thread that runs signal handlers reliably

Thread::Specific

Thread-specific keys

Tie::Array

Base class definitions for tied arrays

Tie::File

Accesses the lines of a disk file via a Perl array (new in 5.8)

Tie::Handle

Base class definitions for tied handles

Tie::Hash

Base class definitions for tied hashes

Tie::Memorize

Adds data to a hash when needed (new in 5.8)

Tie::RefHash

Uses references as hash keys

Tie::Scalar

Base class definitions for tied scalars

Tie::SubstrHash

Fixed table size, fixed key length hashing

Time::gmtime

By-name interface to Perl's built-in gmtime function

Time::HiRes

High-resolution alarm, sleep, gettimeofday, interval timers (new in 5.8)

Time::Local

Computes time from local and GMT time

Time::localtime

By-name interface to Perl's built-in localtime function

Time::tm

Internal object used by Time::gmtime and Time::localtime

UNIVERSAL

Base class for all classes (blessed references)

User::grent

By-name interface to Perl's built-in getgr* functions

User::pwent

By-name interface to Perl's built-in getpw* functions

utf8

Perl pragma to enable/disable UTF-8 in source code

vars

Predeclares global variable names

vmsish

Perl pragma that controls VMS-specific language features (new in 5.8)

XS::Typemap

Module that tests the XS typemaps distributed with Perl (new in 5.8)

In the remainder of this chapter, the modules are arranged in alphabetical order for easy reference. For more detail about a module, use the perldoc command to read the manpage for that module (see Chapter 4, "The Perl Language" for information on perldoc).

8.1. AnyDBM_File

Provides a single Database Manager (DBM) interface regardless of the DBM implementation you use. The module inherits from the various DBM packages; by default, it inherits from NDBM_File. If it doesn't find NDBM_File, the default search order is: DB_File, GDBM_File, SDBM_File (which comes with Perl), and finally, ODBM_File. You can override this default order by redefining @ISA:

@AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File);

However, an explicit use takes priority over the @ISA ordering.

Perl's dbmopen function simply calls tie to bind a hash to AnyDBM_File. The effect is to bind the hash to one of the specific DBM classes that AnyDBM_File inherits from.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.