How to Import a Perl Module

(reproduced from http://perldoc.perl.org/Exporter.html#How-to-Import)


In other files which wish to use your module there are three basic ways for them to load your module and import its symbols:
use YourModule;

This imports all the symbols from YourModule’s @EXPORT into the namespace of the use statement.
use YourModule ();

This causes perl to load your module but does not import any symbols.
use YourModule qw(…);

This imports only the symbols listed by the caller into their namespace. All listed symbols must be in your @EXPORT or @EXPORT_OK , else an error occurs. The advanced export features of Exporter are accessed like this, but with list entries that are syntactically distinct from symbol names.

Tags :