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.

version

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

Get Perl Pocket Reference, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.