in reply to eval "use $module" doesn't

There's another discussion of interface in interface.pm explained

What's wrong with building a list of things to check and then checking them at CHECK time? It seems easier to get right than fiddling around with evals. For example, interface forgets to check $@ for errors after it's eval so if a module has a syntax error you will probably get an error from interface complaining about missing functions when what you really want is something telling you about the syntax error.

Replies are listed 'Best First'.
Re^2: eval "use $module" doesn't
by ysth (Canon) on Aug 03, 2004 at 17:56 UTC
    Doing things at CHECK time limits your module to being used during the initial compile of a script. People like to be able to require or eval "use" modules later than that.
      That's fair enough I suppose. Ideally perl would treat CHECK and INIT blocks as a queue which can be filled up during any compile and are emptied out again after the compile, rather than giving "too late for INIT" messages. Perl 6 perhaps.