Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Re: Re: Create a built-in-like sub?

by chromatic (Archbishop)
on Feb 01, 2002 at 17:43 UTC ( [id://142725]=note: print w/replies, xml ) Need Help??


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.. ;]

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://142725]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-04-23 06:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found