Skip to content
This repository

Suggestion for making it more like an eval #1

Open
cpansprout opened this Issue August 31, 2012 · 2 comments

2 participants

cpansprout R. Bernstein
cpansprout

You say this in the documentation:

=head1 Bugs/Caveats

There doesn't seem to be much benefit here over using C<perl -c> with
C<STDERR> redirected. What I really want is a kind of eval that just
does the syntax checking.

If you want an eval that just does syntax checking, you could wrap everything inside a sub and then evaluate it: eval "sub {$code}".

Another thing you could do is create a wrapper around Parse::Perl (which I think lets you do what you want0.

R. Bernstein
Owner

Many thanks! I really appreciate the ideas and pointers. I need to see what really works best.
The disparate use cases are outline here which I will eventually comment on after I understand what works best. Thanks again.

R. Bernstein
Owner

Some observations with using:

eval "sub { $code }"; 

This catches subroutine prototype mismatches for example where perl -c won't. That may be good or bad depending on what one wants to do. Here is something that doesn't work with eval(), but does work with perl -c:

$x=1; __END__ $y=

Need to also try Parse::Perl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.