in reply to Loading an unknown module

use Module; equates to
BEGIN { require Module; import Module; }
What you want to do is to require the module - and no BEGIN block involved.

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re: Loading an unknown module
by Beatnik (Parson) on Jun 27, 2002 at 23:08 UTC
    Well yeah, I know... the problem is that I dont know what module I'll be loading (I can narrow down to namespace tho). I need to pass parameters to a subroutine in that module too :)

    Greetz
    Beatnik
    ...Perl is like sex: if you're doing it wrong, there's no fun to it.
      you're looking at Aristotls's post, but you aren't reading his words.

      try reading the perldocs for require, import, and use, and then maybe you'll have a better understanding of what he's saying.

      As a hint: you most definitely, absolutely, do NOT want a BEGIN block if you aren't going to know the full Module untill run time. (a close inspection of the "Package Constructors and Destructors" section of the perldoc perlmod should help you see why)