On 7/29/07, I don't like SPAM <[EMAIL PROTECTED]> wrote:

>          eval "require $moduleName";

Hm. You say this isn't working for you, but you're not checking the
value of $@ after the evil eval? (By the way, unless I missed
something, that "require" could load your module, if it loads it at
all, from a different directory than the one you're looking through
via readdir. That may matter to you. Perhaps you want to use local()
on @INC?)

Before I eval a string, I make three promises:

  1. I promise that I know exactly what the string contains.
  2. I promise to check $@ after the eval.
  3. I promise that I really understand the code contained in the string.

If you can find another way to do what you want without eval of a
string, the other way is almost certainly better. (eval of a block is
another matter. Using eval on a block is acceptable, standard
practice; using eval on a string is the evil eval, and should be
avoided.)

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to