[Phoenix-pm] perl eval and the No Execute chips

David A. Sinck phx-pm-list at grueslayer.com
Wed Sep 13 08:43:54 PDT 2006



\_ SMTP quoth Brock on 9/12/2006 22:32 as having spake thusly:
\_
\_ But that's a bit of a side track. Really, let's expand the question to
\_ this -- How does "eval" work?

Better yet, when you get a death from captured by an eval eg: 

---------------
#!/usr/bin/perl

use MIME::Lite;

eval q{
      die fladermous /* if keyboard  */
   };

print $@;
--------------
Bareword found where operator expected at (eval 10) line 2, near "* if
keyboard"
        (Missing operator before keyboard?)
Search pattern not terminated at (eval 10) line 2.
--------------

How do you know in your code which eval \d+ it is?  Sure, if it's a
simple script you can count as it's inc'd from one.  But I want to
know which eval is mine in more robust settings (hence the use in the
exapmle). 

The only way I've solved this before was adding a faulty mini eval
immediately prior to the eval I cared about and and parsing $@ from
that and guessing that it should be a single increment to get to the
eval I cared about.

David


More information about the Phoenix-pm mailing list