@EXPORT, @EXPORT_OK, and @EXPORT_FAIL are described in some detail in the perl documentation: see exporter.
@ISA is used to store the super classes of a class. For more information, on @ISA see perltoot.
Briefly, here's how the two fit together:
- @EXPORT stores the list of subroutines that are exported automatically whenever a user includes the module using use. Exporting lets you use subroutines without the full package qualification: so instead of Toys::Weeble::wobble(...) you can just use wobble(...). However, generally it is not a good idea to export things automatically. It can cause clashes with the names of subroutines in any code that uses your module.
- @EXPORT_OK stores the list of subroutines that can be optionally exported. Those who want to omit the package qualifier from the subroutine name can request the functions to be exported, by adding parameters to the use statement, like this: use Toys::Weeble qw(wobble wontFallDown);
- @EXPORT_FAIL are things you don't want exported. If a module tries to export any subroutine in that list, an error will be generated.
The actual exporting is done by a subroutine named import(...). It processes @EXPORT etc. It also takes the parameters to use and processes them. There is a default definition for it, so unless you want to do something special, you can pretty much forget about it and let the default subroutine do its thing. To get access to the default definition, you need to make your module a subclass of Exporter, hence the @ISA statement.
Best, beth
Update added explanation of how @ISA and @EXPORT etc work together.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.