in reply to Re: How to keep a script from bombing due to a missing module?
in thread How to keep a script from bombing due to a missing module?
Good advice. Further, note that:
use SomeModule ();
is equivalent to:
require SomeModule;
while:
use SomeModule;
is equivalent to:
require SomeModule; SomeModule->import();
with the use done at compile time and the require done at run time. See perlmod for more details.
For this to work smoothly with require, be sure to always call user-defined subroutines in SomeModule with parens, to allow the Perl parser at compile time to recognize subroutine calls in a module that has not been loaded yet.
See also: Re: New Discovery!!! (sub call without parentheses) - Coding Style and Re: How to create symlink using Perl? (Unix symlinks vs Windows Junctions).
|
|---|