They work somewhat like compiler directives (pragmata) in that they tend to affect the compilation of your program, and thus will usually work well only when used within a use
, or no
. Most of these are lexically scoped, so an inner BLOCK may countermand them by saying:
no integer;
no strict 'refs';
no warnings;
which lasts until the end of that BLOCK.
Some pragmas are lexically scoped--typically those that affect the $^H
hints variable. Others affect the current package instead, like use vars
and use subs
, which allow you to predeclare a variables or subroutines within a particular file rather than just a block. Such declarations are effective for the entire file for which they were declared. You cannot rescind them with no vars
or no subs
.
The following pragmas are defined (and have their own documentation).
arybase - Set indexing base via $[
attributes - Get/set subroutine or variable attributes
autodie - Replace functions with ones that succeed or die with lexical scope
autodie::exception - Exceptions from autodying functions.
autodie::exception::system - Exceptions from autodying system().
autodie::hints - Provide hints about user subroutines to autodie
autodie::skip - Skip a package when throwing autodie exceptions
autouse - Postpone load of modules until a function is used
base - Establish an ISA relationship with base classes at compile time
bigint - Transparent BigInteger support for Perl
bignum - Transparent BigNumber support for Perl
bigrat - Transparent BigNumber/BigRational support for Perl
blib - Use MakeMaker's uninstalled version of a package
bytes - Expose the individual bytes of characters
charnames - Access to Unicode character names and named character sequences; also define character names
constant - Declare constants
deprecate - Perl pragma for deprecating the core version of a module
diagnostics - Produce verbose warning diagnostics
encoding - Allows you to write your script in non-ASCII and non-UTF-8
encoding::warnings - Warn on implicit encoding conversions
experimental - Experimental features made easy
feature - Enable new features
fields - Compile-time class fields
filetest - Control the filetest permission operators
if - use
a Perl module if a condition holds (also can no
a module)
integer - Use integer arithmetic instead of floating point
less - Request less of something
lib - Manipulate @INC at compile time
locale - Use or avoid POSIX locales for built-in operations
mro - Method Resolution Order
ok - Alternative to Test::More::use_ok
open - Set default PerlIO layers for input and output
ops - Restrict unsafe operations when compiling
overload - Package for overloading Perl operations
overloading - Lexically control overloading
parent - Establish an ISA relationship with base classes at compile time
re - Alter regular expression behaviour
sigtrap - Enable simple signal handling
sort - Control sort() behaviour
strict - Restrict unsafe constructs
subs - Predeclare sub names
threads - Perl interpreter-based threads
threads::shared - Perl extension for sharing data structures between threads
utf8 - Enable/disable UTF-8 (or UTF-EBCDIC) in source code
vars - Predeclare global variable names
version - Perl extension for Version Objects
vmsish - Control VMS-specific language features
warnings::register - Warnings import function
Standard, bundled modules are all expected to behave in a well-defined manner with respect to namespace pollution because they use the Exporter module. See their own documentation for details.
It's possible that not all modules listed below are installed on your system. For example, the GDBM_File module will not be installed if you don't have the gdbm library.
Amiga::ARexx - Perl extension for ARexx support
Amiga::Exec - Perl extension for low level amiga support
AnyDBM_File - Provide framework for multiple DBMs
App::Cpan - Easily interact with CPAN from the command line
App::Prove - Implements the prove
command.
App::Prove::State - State storage for the prove
command.
App::Prove::State::Result - Individual test suite results.
App::Prove::State::Result::Test - Individual test results.
Archive::Tar - Module for manipulations of tar archives
Archive::Tar::File - A subclass for in-memory extracted file from Archive::Tar
Attribute::Handlers - Simpler definition of attribute handlers
AutoLoader - Load subroutines only on demand
AutoSplit - Split a package for autoloading
B - The Perl Compiler Backend
B::Concise - Walk Perl syntax tree, printing concise info about ops
B::Debug - Walk Perl syntax tree, printing debug info about ops
B::Deparse - Perl compiler backend to produce perl code
B::Op_private - OP op_private flag definitions
B::Showlex - Show lexical variables used in functions or files
B::Terse - Walk Perl syntax tree, printing terse info about ops
B::Xref - Generates cross reference reports for Perl programs
Benchmark - Benchmark running times of Perl code
IO::Socket::IP
- Family-neutral IP socket supporting both IPv4 and IPv6
Socket
- Networking constants and support functions
CORE - Namespace for Perl's core routines
CPAN - Query, download and build perl modules from CPAN sites
CPAN::API::HOWTO - A recipe book for programming with CPAN.pm
CPAN::Debug - Internal debugging for CPAN.pm
CPAN::Distroprefs - Read and match distroprefs
CPAN::FirstTime - Utility for CPAN::Config file Initialization
CPAN::HandleConfig - Internal configuration handling for CPAN.pm
CPAN::Kwalify - Interface between CPAN.pm and Kwalify.pm
CPAN::Meta - The distribution metadata for a CPAN dist
CPAN::Meta::Converter - Convert CPAN distribution metadata structures
CPAN::Meta::Feature - An optional feature provided by a CPAN distribution
CPAN::Meta::History - History of CPAN Meta Spec changes
CPAN::Meta::History::Meta_1_0 - Version 1.0 metadata specification for META.yml
CPAN::Meta::History::Meta_1_1 - Version 1.1 metadata specification for META.yml
CPAN::Meta::History::Meta_1_2 - Version 1.2 metadata specification for META.yml
CPAN::Meta::History::Meta_1_3 - Version 1.3 metadata specification for META.yml
CPAN::Meta::History::Meta_1_4 - Version 1.4 metadata specification for META.yml
CPAN::Meta::Merge - Merging CPAN Meta fragments
CPAN::Meta::Prereqs - A set of distribution prerequisites by phase and type
CPAN::Meta::Requirements - A set of version requirements for a CPAN dist
CPAN::Meta::Spec - Specification for CPAN distribution metadata
CPAN::Meta::Validator - Validate CPAN distribution metadata structures
CPAN::Meta::YAML - Read and write a subset of YAML for CPAN Meta files
CPAN::Nox - Wrapper around CPAN.pm without using any XS module
CPAN::Plugin - Base class for CPAN shell extensions
CPAN::Plugin::Specfile - Proof of concept implementation of a trivial CPAN::Plugin
CPAN::Queue - Internal queue support for CPAN.pm
CPAN::Tarzip - Internal handling of tar archives for CPAN.pm
CPAN::Version - Utility functions to compare CPAN versions
Carp - Alternative warn and die for modules
Class::Struct - Declare struct-like datatypes as Perl classes
Compress::Raw::Bzip2 - Low-Level Interface to bzip2 compression library
Compress::Raw::Zlib - Low-Level Interface to zlib compression library
Compress::Zlib - Interface to zlib compression library
Config - Access Perl configuration information
Config::Perl::V - Structured data retrieval of perl -V output
Cwd - Get pathname of current working directory
DB - Programmatic interface to the Perl debugging API
DBM_Filter - Filter DBM keys/values
DBM_Filter::compress - Filter for DBM_Filter
DBM_Filter::encode - Filter for DBM_Filter
DBM_Filter::int32 - Filter for DBM_Filter
DBM_Filter::null - Filter for DBM_Filter
DBM_Filter::utf8 - Filter for DBM_Filter
DB_File - Perl5 access to Berkeley DB version 1.x
Data::Dumper - Stringified perl data structures, suitable for both printing and eval
Devel::PPPort - Perl/Pollution/Portability
Devel::Peek - A data debugging tool for the XS programmer
Devel::SelfStubber - Generate stubs for a SelfLoading module
Digest - Modules that calculate message digests
Digest::MD5 - Perl interface to the MD5 Algorithm
Digest::SHA - Perl extension for SHA-1/224/256/384/512
Digest::base - Digest base class
Digest::file - Calculate digests of files
DirHandle - Supply object methods for directory handles
Dumpvalue - Provides screen dump of Perl data.
DynaLoader - Dynamically load C libraries into Perl code
Encode - Character encodings in Perl
Encode::Alias - Alias definitions to encodings
Encode::Byte - Single Byte Encodings
Encode::CJKConstants - Internally used by Encode::??::ISO_2022_*
Encode::CN - China-based Chinese Encodings
Encode::CN::HZ - Internally used by Encode::CN
Encode::Config - Internally used by Encode
Encode::EBCDIC - EBCDIC Encodings
Encode::Encoder - Object Oriented Encoder
Encode::Encoding - Encode Implementation Base Class
Encode::GSM0338 - ESTI GSM 03.38 Encoding
Encode::Guess - Guesses encoding from data
Encode::JP - Japanese Encodings
Encode::JP::H2Z - Internally used by Encode::JP::2022_JP*
Encode::JP::JIS7 - Internally used by Encode::JP
Encode::KR - Korean Encodings
Encode::KR::2022_KR - Internally used by Encode::KR
Encode::MIME::Header - MIME 'B' and 'Q' header encoding
Encode::MIME::Name - Internally used by Encode
Encode::PerlIO - A detailed document on Encode and PerlIO
Encode::Supported - Encodings supported by Encode
Encode::Symbol - Symbol Encodings
Encode::TW - Taiwan-based Chinese Encodings
Encode::Unicode - Various Unicode Transformation Formats
Encode::Unicode::UTF7 - UTF-7 encoding
English - Use nice English (or awk) names for ugly punctuation variables
Env - Perl module that imports environment variables as scalars or arrays
Errno - System errno constants
Exporter - Implements default import method for modules
Exporter::Heavy - Exporter guts
ExtUtils::CBuilder - Compile and link C code for Perl modules
ExtUtils::CBuilder::Platform::Windows - Builder class for Windows platforms
ExtUtils::Command - Utilities to replace common UNIX commands in Makefiles etc.
ExtUtils::Command::MM - Commands for the MM's to use in Makefiles
ExtUtils::Constant - Generate XS code to import C header constants
ExtUtils::Constant::Base - Base class for ExtUtils::Constant objects
ExtUtils::Constant::Utils - Helper functions for ExtUtils::Constant
ExtUtils::Constant::XS - Generate C code for XS modules' constants.
ExtUtils::Embed - Utilities for embedding Perl in C/C++ applications
ExtUtils::Install - Install files from here to there
ExtUtils::Installed - Inventory management of installed modules
ExtUtils::Liblist - Determine libraries to use and how to use them
ExtUtils::MM - OS adjusted ExtUtils::MakeMaker subclass
ExtUtils::MM_AIX - AIX specific subclass of ExtUtils::MM_Unix
ExtUtils::MM_Any - Platform-agnostic MM methods
ExtUtils::MM_BeOS - Methods to override UN*X behaviour in ExtUtils::MakeMaker
ExtUtils::MM_Cygwin - Methods to override UN*X behaviour in ExtUtils::MakeMaker
ExtUtils::MM_DOS - DOS specific subclass of ExtUtils::MM_Unix
ExtUtils::MM_Darwin - Special behaviors for OS X
ExtUtils::MM_MacOS - Once produced Makefiles for MacOS Classic
ExtUtils::MM_NW5 - Methods to override UN*X behaviour in ExtUtils::MakeMaker
ExtUtils::MM_OS2 - Methods to override UN*X behaviour in ExtUtils::MakeMaker
ExtUtils::MM_QNX - QNX specific subclass of ExtUtils::MM_Unix
ExtUtils::MM_UWIN - U/WIN specific subclass of ExtUtils::MM_Unix
ExtUtils::MM_Unix - Methods used by ExtUtils::MakeMaker
ExtUtils::MM_VMS - Methods to override UN*X behaviour in ExtUtils::MakeMaker
ExtUtils::MM_VOS - VOS specific subclass of ExtUtils::MM_Unix
ExtUtils::MM_Win32 - Methods to override UN*X behaviour in ExtUtils::MakeMaker
ExtUtils::MM_Win95 - Method to customize MakeMaker for Win9X
ExtUtils::MY - ExtUtils::MakeMaker subclass for customization
ExtUtils::MakeMaker - Create a module Makefile
ExtUtils::MakeMaker::Config - Wrapper around Config.pm
ExtUtils::MakeMaker::FAQ - Frequently Asked Questions About MakeMaker
ExtUtils::MakeMaker::Locale - Bundled Encode::Locale
ExtUtils::MakeMaker::Tutorial - Writing a module with MakeMaker
ExtUtils::Manifest - Utilities to write and check a MANIFEST file
ExtUtils::Miniperl - Write the C code for perlmain.c
ExtUtils::Mkbootstrap - Make a bootstrap file for use by DynaLoader
ExtUtils::Mksymlists - Write linker options files for dynamic extension
ExtUtils::Packlist - Manage .packlist files
ExtUtils::ParseXS - Converts Perl XS code into C code
ExtUtils::ParseXS::Constants - Initialization values for some globals
ExtUtils::ParseXS::Eval - Clean package to evaluate code in
ExtUtils::ParseXS::Utilities - Subroutines used with ExtUtils::ParseXS
ExtUtils::Typemaps - Read/Write/Modify Perl/XS typemap files
ExtUtils::Typemaps::Cmd - Quick commands for handling typemaps
ExtUtils::Typemaps::InputMap - Entry in the INPUT section of a typemap
ExtUtils::Typemaps::OutputMap - Entry in the OUTPUT section of a typemap
ExtUtils::Typemaps::Type - Entry in the TYPEMAP section of a typemap
ExtUtils::XSSymSet - Keep sets of symbol names palatable to the VMS linker
ExtUtils::testlib - Add blib/* directories to @INC
Fatal - Replace functions with equivalents which succeed or die
Fcntl - Load the C Fcntl.h defines
File::Basename - Parse file paths into directory, filename and suffix.
File::Compare - Compare files or filehandles
File::Copy - Copy files or filehandles
File::DosGlob - DOS like globbing and then some
File::Fetch - A generic file fetching mechanism
File::Find - Traverse a directory tree.
File::Glob - Perl extension for BSD glob routine
File::GlobMapper - Extend File Glob to Allow Input and Output Files
File::Path - Create or remove directory trees
File::Spec - Portably perform operations on file names
File::Spec::AmigaOS - File::Spec for AmigaOS
File::Spec::Cygwin - Methods for Cygwin file specs
File::Spec::Epoc - Methods for Epoc file specs
File::Spec::Functions - Portably perform operations on file names
File::Spec::Mac - File::Spec for Mac OS (Classic)
File::Spec::OS2 - Methods for OS/2 file specs
File::Spec::Unix - File::Spec for Unix, base for other File::Spec modules
File::Spec::VMS - Methods for VMS file specs
File::Spec::Win32 - Methods for Win32 file specs
File::Temp - Return name and handle of a temporary file safely
File::stat - By-name interface to Perl's built-in stat() functions
FileCache - Keep more files open than the system permits
FileHandle - Supply object methods for filehandles
Filter::Simple - Simplified source filtering
Filter::Util::Call - Perl Source Filter Utility Module
FindBin - Locate directory of original perl script
GDBM_File - Perl5 access to the gdbm library.
Getopt::Long - Extended processing of command line options
Getopt::Std - Process single-character switches with switch clustering
HTTP::Tiny - A small, simple, correct HTTP/1.1 client
Hash::Util - A selection of general-utility hash subroutines
Hash::Util::FieldHash - Support for Inside-Out Classes
I18N::Collate - Compare 8-bit scalar data according to the current locale
I18N::LangTags - Functions for dealing with RFC3066-style language tags
I18N::LangTags::Detect - Detect the user's language preferences
I18N::LangTags::List - Tags and names for human languages
I18N::Langinfo - Query locale information
IO - Load various IO modules
IO::Compress::Base - Base Class for IO::Compress modules
IO::Compress::Bzip2 - Write bzip2 files/buffers
IO::Compress::Deflate - Write RFC 1950 files/buffers
IO::Compress::FAQ - Frequently Asked Questions about IO::Compress
IO::Compress::Gzip - Write RFC 1952 files/buffers
IO::Compress::RawDeflate - Write RFC 1951 files/buffers
IO::Compress::Zip - Write zip files/buffers
IO::Dir - Supply object methods for directory handles
IO::File - Supply object methods for filehandles
IO::Handle - Supply object methods for I/O handles
IO::Pipe - Supply object methods for pipes
IO::Poll - Object interface to system poll call
IO::Seekable - Supply seek based methods for I/O objects
IO::Select - OO interface to the select system call
IO::Socket - Object interface to socket communications
IO::Socket::INET - Object interface for AF_INET domain sockets
IO::Socket::UNIX - Object interface for AF_UNIX domain sockets
IO::Uncompress::AnyInflate - Uncompress zlib-based (zip, gzip) file/buffer
IO::Uncompress::AnyUncompress - Uncompress gzip, zip, bzip2 or lzop file/buffer
IO::Uncompress::Base - Base Class for IO::Uncompress modules
IO::Uncompress::Bunzip2 - Read bzip2 files/buffers
IO::Uncompress::Gunzip - Read RFC 1952 files/buffers
IO::Uncompress::Inflate - Read RFC 1950 files/buffers
IO::Uncompress::RawInflate - Read RFC 1951 files/buffers
IO::Uncompress::Unzip - Read zip files/buffers
IO::Zlib - IO:: style interface to Compress::Zlib
IPC::Cmd - Finding and running system commands made easy
IPC::Msg - SysV Msg IPC object class
IPC::Open2 - Open a process for both reading and writing using open2()
IPC::Open3 - Open a process for reading, writing, and error handling using open3()
IPC::Semaphore - SysV Semaphore IPC object class
IPC::SharedMem - SysV Shared Memory IPC object class
IPC::SysV - System V IPC constants and system calls
JSON::PP - JSON::XS compatible pure-Perl module.
JSON::PP::Boolean - Dummy module providing JSON::PP::Boolean
List::Util - A selection of general-utility list subroutines
List::Util::XS - Indicate if List::Util was compiled with a C compiler
Locale::Codes - A distribution of modules to handle locale codes
Locale::Codes::API - A description of the callable function in each module
Locale::Codes::Changes - Details changes to Locale::Codes
Locale::Codes::Country - Standard codes for country identification
Locale::Codes::Currency - Standard codes for currency identification
Locale::Codes::LangExt - Standard codes for language extension identification
Locale::Codes::LangFam - Standard codes for language extension identification
Locale::Codes::LangVar - Standard codes for language variation identification
Locale::Codes::Language - Standard codes for language identification
Locale::Codes::Script - Standard codes for script identification
Locale::Country - Standard codes for country identification
Locale::Currency - Standard codes for currency identification
Locale::Language - Standard codes for language identification
Locale::Maketext - Framework for localization
Locale::Maketext::Cookbook - Recipes for using Locale::Maketext
Locale::Maketext::Guts - Deprecated module to load Locale::Maketext utf8 code
Locale::Maketext::GutsLoader - Deprecated module to load Locale::Maketext utf8 code
Locale::Maketext::Simple - Simple interface to Locale::Maketext::Lexicon
Locale::Maketext::TPJ13 - Article about software localization
Locale::Script - Standard codes for script identification
MIME::Base64 - Encoding and decoding of base64 strings
MIME::QuotedPrint - Encoding and decoding of quoted-printable strings
Math::BigFloat - Arbitrary size floating point math package
Math::BigInt - Arbitrary size integer/float math package
Math::BigInt::Calc - Pure Perl module to support Math::BigInt
Math::BigInt::CalcEmu - Emulate low-level math with BigInt code
Math::BigInt::FastCalc - Math::BigInt::Calc with some XS for more speed
Math::BigRat - Arbitrary big rational numbers
Math::Complex - Complex numbers and associated mathematical functions
Math::Trig - Trigonometric functions
Memoize - Make functions faster by trading space for time
Memoize::AnyDBM_File - Glue to provide EXISTS for AnyDBM_File for Storable use
Memoize::Expire - Plug-in module for automatic expiration of memoized values
Memoize::ExpireFile - Test for Memoize expiration semantics
Memoize::ExpireTest - Test for Memoize expiration semantics
Memoize::NDBM_File - Glue to provide EXISTS for NDBM_File for Storable use
Memoize::SDBM_File - Glue to provide EXISTS for SDBM_File for Storable use
Memoize::Storable - Store Memoized data in Storable database
Module::CoreList - What modules shipped with versions of perl
Module::CoreList::Utils - What utilities shipped with versions of perl
Module::Load - Runtime require of both modules and files
Module::Load::Conditional - Looking up module information / loading at runtime