in reply to Module Loading via Exporter doubt.

Inheriting from Exporter means that your module gains a function which is defined in the Exporter package, the "import" function. This means that anyone "using" your package will call Exporters import, to import your exported functions.

You don't need to "use" Exporter, since you do not need any functions from Exporter in your modules namespace.

No, no symbols in your package are automatically exported, you need to tell it exactly which ones you want to export, using the @EXPORT_OK variable.

In short, when someone "uses" your package, which is in turn inheriting from Exporter, the import function is called, which looks at your @EXPORT_OK variable, to decide which symbols to import into the calling codes namespace.

HTH, C.

Replies are listed 'Best First'.
Re^2: Module Loading via Exporter doubt.
by JediWizard (Deacon) on Jul 11, 2005 at 13:56 UTC

    To be complete, I'd like to add: Exporter looks not only at @EXPORT_OK, but also @EXPORT and %EXPORT_TAGS. My personal preference is to use @EXPORT_OK rather than @EXPORT because I feel is is more polite. %EXPORT_TAGS can also be quite useful when properly used.

    See Exporter


    They say that time changes things, but you actually have to change them yourself.

    —Andy Warhol