in reply to
Advice on style
It doesn't matter. What happens is:
- Some other module or program uses your module.
- During its compilation, the perl compiler encounters "use Module1";
- This triggers your module to get compiled; while doing so, Module2 and Module3 will get compiled (if not already compiled). Module2->import and Module3->import will be called.
- Your module will run. First thing it does is to compile Exporter (if it hasn't been compiled already).
- Then Module1->import is called (assuming that other module or program uses "use Module1"). Which means Exporter::import is called.
- Exporter::import exports fn1 and fn2 to the calling module or program.
- Perl will resume compiling the calling module or program.
It doesn't matter where you place 'require Exporter'.
I've never understood why people use the idiom 'require Exporter'. I never do. 'use Exporter();' also compiles Exporter without calling import.