Pragmatic modules affect the compilation of your program. Pragmatic modules can be activated (imported) with use and deactivated with no. These are usually lexically scoped.
Requires Perl to be at least this version and enables the feature bundle for this version. Requiring 5.12 or newer implicitly enables pragma strict.
version can be numeric like 5.005
or 5.008001,
or a v-string like 5.8.1
or V5.14.
Unfortunately, 5.14
is interpreted as 5.140.
With no, requires Perl to be older than the given version and doesn’t enable features.
autodie
Replaces built-in functions with ones that die
upon failure.
attributes
Enables attributes.
autouse
module =>
funcsDetermines that the module will not be loaded until one of the named functions is called.
base
classesEstablishes an IS-A relationship with the named classes at compile time.
bigint
[ options ]Uses the Math::BigInt
package to handle all integer calculations transparently.
options can be accuracy
, precision
, trace
, version
, and lib
. One-letter abbreviations are allowed. Accuracy and precision require a numeric argument, and lib requires the name of a Perl module to handle the calculations.
bignum
[ options ]Uses the Math::BigNum
package to handle all numeric calculations transparently.
See bigint
above for options.
bigrat
Use the Math::BigNum
and Math::BigRat
packages to handle all numeric calculations transparently.
See bigint
above for options.
blib
[ dir ]Uses the MakeMaker’s uninstalled version of a package. dir defaults to the current directory. Used for testing of uninstalled packages.
bytes
Treats character data as strict 8-bit bytes, as opposed to Unicode UTF-8.
charnames
[ sets ]Enables character names to be expanded in strings using N
escapes.
constant
name =>
valueDefines name to represent a constant value.
diagnostics
[ verbosity ]Forces verbose warning diagnostics and suppression of duplicate warnings. If verbosity is -verbose
, makes it even more verbose.
encoding
[ encoding ]encoding
encoding [ STDIN =>
inenc ] [ STDOUT =>
outenc ]Sets the script encoding and pushes the encoding I/O layer for standard input and standard output. The second form allows you to select the I/O layers explicitly.
encoding::warnings
Issues warnings when a non-ASCII character is implicitly converted into UTF-8.
feature
feature [ ,
feature ]Enables features. See the section Features.
fields
namesImplements compile-time verified class fields.
filetest
[ strategy ]Changes the way the file test operators (page 47) get their information. Standard strategy is stat,
alternative is access.
if
condition ,
module =>
argsuses
a module if a condition holds.
integer
Enables integer arithmetic instead of double precision floating point.
less
whatRequests less of something (unimplemented).
lib
namesAdds libraries to @INC
, or removes them, at compile time.
locale
Uses POSIX locales for built-in operations.
mro
typeUse method resolution order type. Values are dfs
(default) and c3.
open
Establishes default I/O layers for input and output.
ops
operationsRestricts unsafe operations when compiling.
overload
operator =>
subrefOverloads Perl operators. operator is the operator (as a string), subref a reference to the subroutine handling the overloaded operator.
overloading
parent
classesEstablishes an IS-A relationship with the named classes at compile time.
re
[ behaviors | "/
flags"
]Alters regular expression behavior. behaviors can be any combination of eval
(allows patterns to contain assertions that execute Perl code, even when the pattern contains interpolated variables; see page 39), taint
(propagates tainting), debug,
and debugcolor
(produce debugging info).
flags can be used to set default flags for regular expressions.
sigtrap
infoEnables simple signal handling. info is a list of signals, e.g., qw(SEGV TRAP).
sort
[ options ]Controls sort behavior. options can be stable
to require stability, _quicksort
(or _qsort)
to use a quicksort algorithm, and _mergesort
to use a mergesort algorithm.
strict
[ constructs ]Restricts unsafe constructs. constructs can be any combination of refs
(restricts the use of symbolic references), vars
(requires all variables to be either predefined by Perl, imported, globally or lexically scoped, or fully qualified), and subs
(restricts the use of bareword identifiers that are not subroutines).
subs
namesPredeclares subroutine names so you can use them without parentheses even before they are declared.
threads
Enables the use of interpreter-based threads. See the section Threads.
threads::shared
Adds data sharing between threads.
utf8
vars
namesPredeclares variable names, allowing you to use them even if they are not fully qualified under the strict
pragma. Obsolete; use our (page 63) instead.
version
Provides support for version objects.
vmsish
[ features ]Controls VMS-specific language features. VMS only. features can be any combination of exit
(enables VMS-style exit codes), status
(allows system commands to deliver VMS-style exit codes to the calling program), and time
(makes all times relative to the local time zone).
warnings
[ class ]Controls built-in warnings for classes of conditions.
warnings::register
Creates a warnings category for the current package.