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

Scott Walters scott at
Wed Sep 13 18:27:49 PDT 2006


Maybe 99% was a bit dramatic.  As long as you're setting up the config files
and bad people don't have write access to them, you're fine, and that's
a legit use of eval.  Usually I 'require' or 'use' files like that (and put a 
1; on the end of them) rather than 'eval', but there isn't *that* much 
difference (the perldoc for require and use point out the other little helpful
things they do).  And of course bad people shouldn't be able to specify which file 
gets used as the config file without serious restriction on their choice.

-scott

On  0, Jerry Davis <jdawgaz at cox.net> wrote:
> On Wed, 13 Sep 2006 17:37:06 +0000
> Scott Walters <scott@> wrote:
> 
> > Stops executing, starts parsing/compiling again, and then executes the
> > result of that again.  I've said it before and I'll say it again...
> > 95% of the time people eval, they really want a closure instead.
> 
> the reason I asked, is that I do make use of eval, and in what I think
> is a legal way.
> 
> what I normally do in an eval, is on the command line I pass the name
> of a file which is really a short perl script which is really a hash
> full of static data.
> 
> sort of like:
> 
> our %h;
> 
> $h{somekey}{somesubkey} = value;
> ...
> 
> I then eval this file, which sets sets up my all my data, and I just
> use that data in the program.
> 
> Different files hold exactly the same hash but with different values.
> 
> This has worked really really well for me, and I was just a little
> alarmed over what I saw on /.
> 
> Jerry
> 
> 
> 
> > 
> > -scott
> > 
> > On  0, Andrew Johnson <andypm at exiledplanet.org> wrote:
> > > 
> > >    On 9/12/06, Brock <[1]awwaiid at thelackthereof.org> wrote:
> > >    
> > >    <snip>
> > >    
> > >    
> > >      But that's a bit of a side track. Really, let's expand the
> > > question to
> > >      this -- How does "eval" work?
> > >      
> > >    That's easy:  it's MAGIC!!  :-)
> > >    [aj]
> > > 
> > > References
> > > 
> > >    1. mailto:awwaiid at thelackthereof.org
> > 
> > > _______________________________________________
> > > Phoenix-pm mailing list
> > > Phoenix-pm at pm.org
> > > http://mail.pm.org/mailman/listinfo/phoenix-pm
> > _______________________________________________
> > Phoenix-pm mailing list
> > Phoenix-pm at pm.org
> > http://mail.pm.org/mailman/listinfo/phoenix-pm
> 
> 
> -- 
> Happy Trails!
>  
> Hobbit Name: Pimpernel Loamsdown
> Registered Linux User: 275424
>  
> Jeep Motto #2: Paved Roads are a Fine Example of Needless Government
> Spending!
> _______________________________________________
> Phoenix-pm mailing list
> Phoenix-pm at pm.org
> http://mail.pm.org/mailman/listinfo/phoenix-pm


More information about the Phoenix-pm mailing list