<?xml version="1.0" encoding="windows-1252"?>
<node id="452280" title="Re: eval inside an object" created="2005-04-28 08:29:49" updated="2005-06-23 22:05:52">
<type id="11">
note</type>
<author id="176576">
eyepopslikeamosquito</author>
<data>
<field name="doctext">
&lt;P&gt;
&lt;blockquote&gt;
&lt;I&gt;I am messing around with eval since it's cool&lt;/I&gt;
&lt;/blockquote&gt;
Block eval (for exception handling) is cool; string eval is  ... luke warm. OK, it is fun, but you should try to avoid
it in production code.
Quoting [merlyn] from [id://405165]:
&lt;blockquote&gt;
&lt;I&gt;
Do not resort to eval-string if other means are available. You're firing up the compiler (slower than almost any other solution), and exposing yourself to hard to debug and hard to secure practices.
&lt;/I&gt;
&lt;/blockquote&gt;
&lt;/P&gt;

&lt;P&gt;
&lt;B&gt;Update:&lt;/B&gt; If you want a second opinion, see
&lt;a href="http://perl.plover.com/qotw/e/solution/001"&gt;this quiz of the week&lt;/a&gt; where MJD states:
&lt;blockquote&gt;
&lt;I&gt;
A good rule of thumb is that unless what you're trying
to do is most clearly described as "compile and run
arbitrary Perl code", it's probably a mistake to
use 'eval' to do it.
&lt;/I&gt;
&lt;/blockquote&gt;
&lt;/P&gt;

&lt;P&gt;
Somewhat related, symbolic references are also evil,
as convincingly demonstrated by MJD in three parts:
&lt;a href="http://perl.plover.com/varvarname.html"&gt;part 1&lt;/a&gt; and &lt;a href="http://perl.plover.com/varvarname2.html"&gt;part 2&lt;/a&gt; and &lt;a href="http://perl.plover.com/varvarname3.html"&gt;part 3&lt;/a&gt;.
&lt;/P&gt;
</field>
<field name="root_node">
452015</field>
<field name="parent_node">
452015</field>
</data>
</node>
