Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^4: Dynamically Changing Packages w/out Eval

by ikegami (Pope)
on Aug 24, 2009 at 14:43 UTC ( #790837=note: print w/ replies, xml ) Need Help??


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

True, but he wanted to avoid eval "because it obfuscates the code". It's clearly the opposite here.


Comment on Re^4: Dynamically Changing Packages w/out Eval
Download Code
Re^5: Dynamically Changing Packages w/out Eval
by betterworld (Deacon) on Aug 24, 2009 at 19:54 UTC

    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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://790837]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2014-08-21 03:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (127 votes), past polls