How to ImportIn other files which wish to use your module there are three basic ways for them to load your module and import its symbols:
- use ModuleName;
This imports all the symbols from ModuleName's @EXPORT into the namespace of the use statement.
- use ModuleName ();
This causes perl to load your module but does not import any symbols.
- use ModuleName 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.
Unless you want to use its advanced features, this is probably all you need to know to use Exporter.
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
In reply to Re: exporter question
by CountZero
in thread exporter question
by megamic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |