Chapter 14. Pragmatic Modules

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.

attributes

Enables attributes.

autouse module => funcs

Determines that the module will not be loaded until one of the named functions is called.

base classes

Establishes 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 on the facing page for options.

bigrat

Use the Math::BigNum and Math::BigRat packages to handle all numeric calculations transparently.

See bigint on the preceding page 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

Treat 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 => value

Defines 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.

fields names

Implements compile-time verified class fields.

filetest [ strategy ]

Changes the way the Chapter 24 get their information. Standard strategy is stat, alternative is access.

if condition , module => args

uses a module if a condition holds.

integer

Enables integer arithmetic instead of double precision floating point.

less what

Requests less of something (unimplemented).

lib names

Adds libraries to @INC, or removes them, at compile time.

locale

Uses POSIX locales for built-in operations.

open

Establishes default I/O layers for input and output.

ops operations

Restricts unsafe operations when compiling.

overload operator => subref

Overloads Perl operators. operator is the operator (as a string), subref a reference to the subroutine handling the overloaded operator.

re behaviors

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 ???), taint (propagates tainting), debug, and debugcolor (produce debugging info).

sigtrap info

Enables simple signal handling. info is a list of signals, e.g., qw(SEGV TRAP).

sort [ options ]

Controls sort behaviour. 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, global or lexical scoped, or fully qualified), and subs (restricts the use of bareword identifiers that are not subroutines).

subs names

Predeclares subroutine names, allowing you to use them without parentheses even before they are declared.

threads

Enables the use of interpreter-based threads. See the section Chapter 40.

threads::shared

Adds data sharing between threads.

utf8

Enables or disables UTF-8 (or UTF-EBCDIC) in source code.

vars names

Predeclares variable names, allowing you to use them even if they are not fully qualified under the strict pragma. Obsolete; use our instead.

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.

perlmodlib.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset