in reply to Re^3: when is a perl module executed?
in thread when is a perl module executed?
I personally believe that you're confused (and incidentally the way you like to write tends to confirm that you are:) people clearly told you that you can have code out of subs in modules. That is, it's valid Perl. People generally use modules as collections of reusable code: subs to be imported as additions to the builtins or methods of some class. There's no reason they shouldn't also do things. Indeed, they often have to, to "initialize" in some way or another those collections of code. For example, think of a module which will connect to some site to retrieve some info and build suitable "constants" - it's not that strange...
|
|---|