in reply to loading a module only if you need it

Keep in mind that use is a compile-time operation. If you try to do it at runtime, you won't get the prototypes set at the proper time. Having said that, just change your use to a require and you're done!

-- Randal L. Schwartz, Perl hacker


update: yes, as tilly points out, you'll need to change
use FOO;
to
require FOO; FOO->import();
and
use FOO qw(BAR);
to
require FOO; FOO->import(qw(BAR));
Thanks for that! But remember, you still don't get prototypes.

Replies are listed 'Best First'.
RE (tilly) 2: loading a module only if you need it
by tilly (Archbishop) on Oct 09, 2000 at 20:40 UTC
    Not necessarily done. You may need to import foo(); if the modules are exporting things to your current namespace.