modules

CONTENTS

Pragmatic Modules

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

  • 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 subroutine 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 Modules

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.

© 1993–2020 Larry Wall and others
Licensed under the GNU General Public License version 1 or later, or the Artistic License.
The Perl logo is a trademark of the Perl Foundation.
https://perldoc.perl.org/5.28.3/modules.html