ЭЛЕКТРОННАЯ БИБЛИОТЕКА КОАПП
Сборники Художественной, Технической, Справочной, Английской, Нормативной, Исторической, и др. литературы.



Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: 7.4 Object SyntaxChapter 8Next: 8.2 attrs
 

8. Standard Modules

Contents:
AnyDBM_File
attrs
AutoLoader
AutoSplit
autouse
B
B::Asmdata
B::Assembler
B::Bblock
B::Bytecode
B::C
B::CC
B::Debug
B::Deparse
B::Disassembler
B::Lint
B::Showlex
B::Stackobj
B::Terse
B::Xref
base
Benchmark
blib
Carp
CGI
CGI::Apache
CGI::Carp
CGI::Cookie
CGI::Fast
CGI::Push
CGI::Switch
Class::Struct
Config
constant
CPAN
CPAN::FirstTime
CPAN::Nox
Cwd
Data::Dumper
DB_File
Devel::SelfStubber
diagnostics
DirHandle
DynaLoader
English
Env
Errno
Exporter
ExtUtils::Command
ExtUtils::Embed
ExtUtils::Install
ExtUtils::Installed
ExtUtils::Liblist
ExtUtils::MakeMaker
ExtUtils::Manifest
ExtUtils::Miniperl
ExtUtils::Mkbootstrap
ExtUtils::Mksymlists
ExtUtils::MM_OS2
ExtUtils::MM_Unix
ExtUtils::MM_VMS
ExtUtils::MM_Win32
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::Mac
File::Spec::OS2
File::Spec::Unix
File::Spec::VMS
File::Spec::Win32
File::stat
FileCache
FileHandle
FindBin
GDBM_File
Getopt::Long
Getopt::Std
I18N::Collate
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
locale
Math::BigFloat
Math::BigInt
Math::Complex
Math::Trig
NDBM_File
Net::hostent
Net::netent
Net::Ping
Net::protoent
Net::servent
O
ODBM_File
Opcode
ops
overload
Pod::Functions
Pod::Html
Pod::Text
POSIX
re
Safe
SDBM_File
Search::Dict
SelectSaver
SelfLoader
Shell
sigtrap
Socket
strict
subs
Symbol
Sys::Hostname
Sys::Syslog
Term::Cap
Term::Complete
Term::ReadLine
Test
Test::Harness
Text::Abbrev
Text::ParseWords
Text::Soundex
Text::Tabs
Text::Wrap
Thread
Thread::Queue
Thread::Semaphore
Thread::Signal
Thread::Specific
Tie::Array, Tie::StdArray
Tie::Handle
Tie::Hash, Tie::StdHash
Tie::RefHash
Tie::Scalar, Tie::StdScalar
Tie::SubstrHash
Time::gmtime
Time::Local
Time::localtime
Time::tm
UNIVERSAL
User::grent
User::pwent
vars
vmsish

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, Win32 Modules and Extensions.

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

ModuleFunction
AnyDBM_File

Provides framework for multiple DBMs

attrs

Sets or gets attributes of a subroutine

AutoLoader

Loads functions only on demand

AutoSplit

Splits a module for autoloading

autouse

Postpones load of 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

blib

Uses MakeMaker's uninstalled version of a package

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::CookieCGI interface to Netscape (HTTP/1.1) cookies
CGI::FastCGI interface for FastCGI
CGI::PushInterface for server push operations
CGI::Switch

Tries multiple constructors and returns the first available CGI object

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_File

Accesses Berkeley DB

Devel::SelfStubber

Generates stubs for a selfloading module

diagnostics

Forces verbose warning diagnostics

DirHandle

Supplies object methods for directory handles

DynaLoader

Automatic dynamic loading of Perl modules

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::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_OS2

Methods to override Unix behavior in ExtUtils::MakeMaker

ExtUtils::MM_Unix

Methods used by ExtUtils::MakeMaker

ExtUtils::MM_VMS

Methods to override Unix behavior in ExtUtils::MakeMaker

ExtUtils::MM_Win32

Methods to override Unix behavior in ExtUtils::MakeMaker

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::stat

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

FileCache

Keeps more files open than the system permits

FileHandle

Supplies object methods for filehandles

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

I18N::Collate

Compares 8-bit scalar data according to the current locale

integer

Does arithmetic in integer instead of double

IO

Loads various IO 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

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::ComplexComplex numbers package
Math::Trig

Trigonometric functions

NDBM_File

Tied access to NDBM files

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::Ping

Checks whether a host is online

Net::protoent

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

Net::servent

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

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

Pod::Functions

Used in converting from pod to HTML

Pod::Html

Module to convert pod files to HTML

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

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

strict

Restricts unsafe constructs

subs

Predeclares subroutine names

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::Harness

Runs Perl standard test scripts with statistics

Text::Abbrev

Creates an abbreviation table from a list

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::Handle

Base class definitions for tied handles

Tie::Hash, Tie::StdHash

Base class definitions for tied hashes

Tie::RefHash

Uses references as hash keys

Tie::Scalar, Tie::StdScalar

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::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

vars

Predeclares global variable names

vmsish

Enables VMS-specific language features

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 DBM (Database Manager) 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 actually just 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.


Previous: 7.4 Object SyntaxPerl in a NutshellNext: 8.2 attrs
7.4 Object SyntaxBook Index8.2 attrs