in reply to How to do perl -c inside perl?
The solution that satisfies the most is to wrap the code I want to try inside a eval "sub {$code}".
Starting with commit 0067b6c, I have been using this approach and have been most pleased with it. It will catch things like prototype mismatches which is not strictly a syntax checking thing. That may be good or bad depending on your needs.
This code: $x=1; __END__ $y= will be tagged as a syntax error when it is not. But this is not of great concern to me.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to do perl -c inside perl?
by LanX (Saint) on Sep 11, 2012 at 11:16 UTC | |
by rockyb (Scribe) on Sep 11, 2012 at 18:16 UTC | |
by LanX (Saint) on Sep 12, 2012 at 13:54 UTC | |
by rockyb (Scribe) on Sep 19, 2012 at 00:16 UTC | |
by LanX (Saint) on Sep 19, 2012 at 09:12 UTC |