|
in reply to Perl doesn't give error when module is not found 2
- If module A uses something from module B, then there OUGHT TO BE use B; inside A.pm. Fullstop. Modules should not expect someone else to load their dependencies for them. There is no need to "optimize" and use a module just one. Perl is clever enough to notice the module had already been loaded and it doesn't load it twice.
The second time Perl only calls the module's import() subroutine to allow it to export the default list of functions into the calling namespace.
- You are NOT supposed to run modules directly. Very few modules support that and likely even fewer should.
- Modules and namespaces are related, but they are NOT the same thing. You can have several namespaces right inside your a.pl script and define the myModule2:authorize right there. It's actually quite common for modules to contain several namespaces. One of them SHOULD match the name of the file, but there's often several others inside.
Jenda
1984 was supposed to be a warning,
not a manual!
|