Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: loading modules using 'use'

by Taulmarill (Deacon)
on Jun 30, 2010 at 11:30 UTC ( #847300=note: print w/replies, xml ) Need Help??


in reply to loading modules using 'use'

When you use a module, it not only gets compiled but also executed before the program that uses the module runs. So the require is executed at runtime of module A which happens at compile time of the program.
Btw. you may want to get a little more creative with your package names. A may be fine, but B is a core module.

Replies are listed 'Best First'.
Re^2: loading modules using 'use'
by angshuman (Novice) on Jun 30, 2010 at 11:45 UTC
    Thanks for the quick response, and suggestion, will keep those in mind. One more thing, consider I modified the code piece to the below mentioned code, where I introduce a BEGIN block. How does that help ?....have noticed that in case of circular inheritence/dependency situations the below mentioned code works, rather than the previous one without BEGIN blocks.
    package A; use strict; our (@ISA,@EXPORT); BEGIN{ require Exporter; @ISA = qw(Exporter); @EXPORT = qw( abc ); } #................ # Some code here #................ 1;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2023-03-31 02:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (74 votes). Check out past polls.

    Notices?