in reply to Re: Re: Create a built-in-like sub?
in thread Create a built-in-like sub?

Exporting (through Exporter or otherwise) comes in two parts. The code to export needs to declare what it will export. That's what using Exporter and populating @EXPORT or @EXPORT_OK does for you.

The code that wants to import also must do something -- namely, asking the other code to import stuff. If you require MODULE, you need to call MODULE->import(). If you use MODULE, Perl will call import() automatically.

Where did import() come from in MODULE? It came from using Exporter. If you'd require()d Exporter, you'd have had to call Exporter->import().

Does that help?

Replies are listed 'Best First'.
Re: Re: Re: Re: Create a built-in-like sub?
by mirg drol (Initiate) on Feb 05, 2002 at 14:27 UTC
    thanks everybody, i know how to use Exporter now, and i see that i tried to use it in a way that wasn't very pretty.. ;] slowly i'm learning.. ;]