http://qs1969.pair.com?node_id=790827


in reply to Re^2: Dynamically Changing Packages w/out Eval
in thread Dynamically Changing Packages w/out Eval

I thought the original question was how to avoid eval :)
  • Comment on Re^3: Dynamically Changing Packages w/out Eval

Replies are listed 'Best First'.
Re^4: Dynamically Changing Packages w/out Eval
by ikegami (Patriarch) on Aug 24, 2009 at 14:43 UTC
    True, but he wanted to avoid eval "because it obfuscates the code". It's clearly the opposite here.

      I avoid eval out of habit. Even if you make sure that you don't eval user input and keep the evaluated code minimal, it's still annoying to debug warnings like "Argument isn't numeric at eval 2718, line 314".

      Though you're right that my code looks a bit obfuscated.

        it's still annoying to debug warnings like "Argument isn't numeric at eval 2718, line 314".

        Note that my code does nothing but load a module. Everything is calculate beforehand. To avoid problems such as the one you mention, calculate everything in advance or move the calculations into a sub called from the evaluated code.

        There's something very wrong if you're evaluating 314 lines.

Re^4: Dynamically Changing Packages w/out Eval
by Anonymous Monk on Aug 24, 2009 at 14:15 UTC
    You can't expect someone to read the OP