|
Many modules are included the Perl distribution. These are described below, and all end in .pm.
You may discover compiled library file (usually ending in .so) or small pieces of
modules to be autoloaded (ending in .al); these were automatically generated by the
installation process. You may also discover files in the library directory that end in either .pl
or .ph. These are old libraries supplied so that old programs that use them still run.
The .pl files will all eventually be converted into standard modules, and the .ph
files made by h2ph will probably end up as extension modules made by h2xs. (Some
.ph values may already be available through the POSIX, Errno, or Fcntl modules.) The pl2pm
file in the distribution may help in your conversion, but it's just a mechanical process and
therefore far from bulletproof.
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).
- attributes
- Get/set subroutine or variable attributes
- attrs
- Set/get attributes of a subroutine (deprecated)
- autouse
- Postpone load of modules until a function is used
- base
- Establish IS-A relationship with base class at compile time
- bigint
- Transparent big integer 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
- Define character names for
\N{named} string literal escapes
- constant
- Declare constants
- diagnostics
- Perl compiler pragma to force verbose warning diagnostics
- encoding
- Allows you to write your script in non-ascii or non-utf8
- 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 from the compiler
- locale
- Use and avoid POSIX locales for built-in operations
- open
- Set default PerlIO layers for input and output
- ops
- Restrict unsafe operations when compiling
- overload
- Package for overloading perl operations
- re
- Alter regular expression behaviour
- sigtrap
- Enable simple signal handling
- sort
- Control sort() behaviour
- strict
- Restrict unsafe constructs
- subs
- Predeclare sub names
- threads
- Perl extension allowing use of interpreter based threads from perl
- utf8
- Enable/disable UTF-8 (or UTF-EBCDIC) in source code
- vars
- Predeclare global variable names (obsolete)
- vmsish
- Control VMS-specific language features
- warnings
- Control optional warnings
- warnings::register
- Warnings import function
|
|