Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: Perl thread issue (updated)

by haukex (Archbishop)
on Dec 29, 2016 at 11:15 UTC ( [id://1178613]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Perl thread issue
in thread Perl thread issue

Hi gurjit,

load order shouldn't matter

That's true in many cases, but with certain modules, load order can matter. Note that use is equivalent to BEGIN { require Module; Module->import( LIST ); }, and the module's import method can be arbitrary Perl code, and require will essentially eval the file once, also allowing for arbitrary code to be executed. For many modules, they just contain sub definitions and don't execute any code that affects other things in your program, and their import is just Exporter's import and all it does is export certain names, or OO modules may not define an import at all. But a few modules out there can do some pretty complex things upon being used, and in that case, order of loading can make a difference.

Regards,
-- Hauke D

Update: Previously, in the above I just talked about the effects of the import method; I've now updated the text to talk about the eval of the code as well.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-19 09:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found