Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Here's a discussion from the Original Monks regarding eval in this context. Am I overlooking the obvious? I know I could shell out to perl -wc but it seems to be an overkill since I really just want to check that one little code block. I thought the B: or O: modules might help but I can't figure out how they might. Ideas?my $str = <<'CODEIMPORT'; # this code block would be dynamic print "Don't run me!\n"; prnt 'Just check me for errors\n": CODEIMPORT # eval $str; # gives a run-time error eval { $str; }; # compiles (?) - but does not check syntax # I just want to check for syntax - # it will evaluated later and in a new/different context # (e.g., passed to a different script)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Embedded Syntax Checker?
by merlyn (Sage) on Apr 21, 2004 at 15:00 UTC | |
|
Re: Embedded Syntax Checker?
by sgifford (Prior) on Apr 21, 2004 at 15:28 UTC | |
by Anonymous Monk on Apr 21, 2004 at 16:22 UTC | |
by dragonchild (Archbishop) on Apr 22, 2004 at 15:26 UTC | |
by flyingmoose (Priest) on Apr 21, 2004 at 19:06 UTC | |
|
Re: Embedded Syntax Checker?
by borisz (Canon) on Apr 21, 2004 at 15:02 UTC | |
by Anonymous Monk on Apr 21, 2004 at 16:08 UTC | |
|
Re: Embedded Syntax Checker?
by bronto (Priest) on Apr 21, 2004 at 15:09 UTC |