in reply to Re: eval, but syntax-check only -- like perl -c
in thread eval, but syntax-check only -- like perl -c

I guess there's nothing particularly wrong with the system call: indeed, in some ways it works better. For example, "use strict" doesn't work inside an eval.

One of the nice things about the 'eval "sub { $txt }"' approach is that it gives me a code ref that I can call later if I want. This means that I can have a two-pass approach: in the first I gather/check all my fragments; and in the second I run selected ones. This isn't my current plan, but is nice to have the flexibility.

--Dave

  • Comment on Re: Re: eval, but syntax-check only -- like perl -c

Replies are listed 'Best First'.
Re^3: eval, but syntax-check only -- like perl -c
by particle (Vicar) on Apr 25, 2003 at 03:04 UTC

    there's room for that here, as well. create a hash with nice names as keys, and filehandles or filenames or the code snippets themselves as values. you still have the two-pass approach, but if you write to disk and keep the filehandles or filenames around, you can always slurp them in quickly to run them. heck, you can do with them what you will.

    ~Particle *accelerates*