use

useMODULEVERSIONLISTuseMODULEVERSION() useMODULEVERSIONuseMODULELISTuseMODULE() useMODULEuseVERSION
The use declaration loads in a module, if it hasn’t been loaded before, and
imports subroutines and variables into the current package from the
named module. (Technically speaking, it imports some semantics into the
current package from the named module, generally by aliasing certain
subroutine or variable names into your package.) Most use declarations look like this:
use MODULE LIST;
That is exactly equivalent to saying:
BEGIN { require MODULE; import MODULE LIST }The BEGIN forces the require and import to happen at compile time. The require makes sure the module is loaded into
memory if it hasn’t been yet. The import is not a built-in—it’s just an ordinary
class method call into the package named by
MODULE to tell that module to pull the list
of features back into the current package. The module can implement its
import method any way it likes, though most modules just choose to
derive their import method via inheritance from the Exporter class that
is defined in the Exporter module. See Chapter 11 and the Exporter module for more information. If no
import method can be found, then the
call is skipped without murmur.
If you don’t want your namespace altered, supply ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access