Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^5: Dynamically Changing Packages w/out Eval

by betterworld (Curate)
on Aug 24, 2009 at 19:54 UTC ( [id://790909]=note: print w/replies, xml ) Need Help??


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

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.

  • Comment on Re^5: Dynamically Changing Packages w/out Eval

Replies are listed 'Best First'.
Re^6: Dynamically Changing Packages w/out Eval
by ikegami (Patriarch) on Aug 24, 2009 at 21:35 UTC

    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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://790909]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-25 05:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found