Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: calling module with empty import

by gaal (Parson)
on May 17, 2007 at 07:25 UTC ( #615945=note: print w/ replies, xml ) Need Help??

in reply to calling module with empty import

Export/import happens in Perl by convention: "use Module" calls Module::import, which typically does some initialization and places symbols in the caller's namespace.

It's recommended that module authors not export things by default, but some modules don't follow that recommendation. For example, YAML exports Dump and Load. What if your code already defines subs with those names? You still want to be able to use YAML's functions, e.g. by saying YAML::Dump($obj), but you don't want the default import. So you "import" (), and YAML::import never gets called. Note that if had had some important initialization it only did in its import sub, that would be missed.

Comment on Re: calling module with empty import
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2016-05-25 09:24 GMT
Find Nodes?
    Voting Booth?