In general, I have two types of modules:
- Modules which are really related collections of functions
- Modules which implement classes for OO perl
In the former case, the Modules themselves are "stateless" -- i.e. they have no variables of its own. All data is passed to the various functions as function arguments. If those functions call other functions, they pass what arguments they need.
In the latter case, data is passed in to the modules as parameters to the objects (as someone else already mentioned), and thus the data can be shared among the functions without being explicitly passed.
Module-level state is problematic -- if multiple subsystems of your code use the same module, they might bang into each other.
This is the same problem in general with global variables -- they act against subsystem decoupling, which is a powerful technique for minimizing the complexity, and thus increasing the reliability and extensibility, of the systems we are building.
This is not to say that module-level state should never be used, but you should think carefully about the extensibility ramifications if you do use it, and have a good reason to pay this cost.
Sort of a long answer for saying "function paraments or object instance variables..." I hope this helps...
--JAS