Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Understanding use and require fully

by rpike (Scribe)
on Aug 01, 2008 at 15:36 UTC ( [id://701728]=note: print w/replies, xml ) Need Help??


in reply to Understanding use and require fully

Thanks all for the helpful info. pc88mxer (and all) just wondering if you could comment on my below points/questions : 1) when I create a module that I include in the main script using "use" I end up requiring Exporter in the module that (I guess) provides a means to exporting everything into my main script. If I were to exclude the Exporter what "use" would use Module be in my main script? 2) since BEGIN { require Module..... } mimics a "use" statement is it because BEGIN happens at compile time like the use forcing the time of evaluation for the require? 3) without using require or importing is there is way to still use the modules effectively? Sorry for the elementary questions, just trying to get a thorough understanding of what each does and where each can or cannot be used. Thanks so much again. Rob
  • Comment on Re: Understanding use and require fully

Replies are listed 'Best First'.
Re^2: Understanding use and require fully
by jethro (Monsignor) on Aug 01, 2008 at 16:12 UTC
    1) Exporter is a way to export names into your namespace. If you use a module that doesn't use Exporter or something similar, you can still use the module, but for example a sub DoPiff() in module Bang cannot be called as DoPiff() (would generate an error) but only as Bang::DoPiff()

    2) not really understanding the question.

    3) If you don't use, require, do or eval a module, that module doesn't exist for your script.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-25 06:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found