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

thanks man. I just loaded threads first and it solved. weird as load order shouldn't matter unless all those perl modules are loaded

Replies are listed 'Best First'.
Re^3: Perl thread issue (updated)
by haukex (Archbishop) on Dec 29, 2016 at 11:15 UTC

    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.