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
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 - Force byte semantics rather than character semantics
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 or non-utf8
encoding::warnings - Warn on implicit encoding conversions
feature - Enable new features
fields - Compile-time class fields
filetest - Control the filetest permission operators
if - use
a Perl module if a condition holds
inc::latest - Use modules bundled in inc/ if they are newer than installed ones
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
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
perldoc - Look up Perl documentation in Pod format.
perlfaq - Frequently asked questions about Perl
perlfaq1 - General Questions About Perl
perlfaq2 - Obtaining and Learning about Perl
perlfaq3 - Programming Tools
perlfaq4 - Data Manipulation
perlfaq5 - Files and Formats
perlfaq6 - Regular Expressions
perlfaq7 - General Perl Language Issues
perlfaq8 - System Interaction
perlfaq9 - Web, Email and Networking
perlfunc - Perl builtin functions
perlglossary - Perl Glossary
perlpodspeccopy - Plain Old Documentation: format specification and notes
perlvarcopy - Perl predefined variables
perlxs - XS language reference manual
perlxstut - Tutorial for writing XSUBs
perlxstypemap - Perl XS C/Perl type mapping
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 - Control optional warnings
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.
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::Extract - A generic archive extracting mechanism
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::Lint - Perl lint
B::Lint::Debug - Adds debugging stringification to B::
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
Socket
- Networking constants and support functions
CGI - Handle Common Gateway Interface requests and responses
CGI::Apache - Backward compatibility module for CGI.pm
CGI::Carp - CGI routines for writing to the HTTPD (or other) error log
CGI::Cookie - Interface to HTTP Cookies
CGI::Fast - CGI Interface for Fast CGI
CGI::Pretty - Module to produce nicely formatted HTML code
CGI::Push - Simple Interface to Server Push
CGI::Switch - Backward compatibility module for defunct CGI::Switch
CGI::Util - Internal utilities used by CGI module
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::Prereqs - A set of distribution prerequisites by phase and type