The Exporter Package

The Exporter package defines a function called import. Unlike the other packages discussed, the import function does what it’s supposed to do, namely import a function from the package into the caller’s namespace. It does this through some magic involving typeglobs and references, but it doesn’t matter how it does it; the thing works.

This is another case of a Perl module using some of the hidden syntax features of the language to modify the program—in this case, the symbol table—on-the-fly.

Get Perl for C Programmers 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.