Is there a way to test if Perl code is valid, without having the Perl code you want to validate, affect the rest of the script?No. Consider:
Valid or not? Without executing the begin block, impossible to answer. (It's valid if the prototype is empty, it's a syntax error otherwise.)BEGIN { my $p = rand() < .5 ? '$' : ''; eval "sub foo($p) {1;}"; } foo / 1;
In reply to Re: Testing if Perl Code is Valid - but don't execute!
by JavaFan
in thread Testing if Perl Code is Valid - but don't execute!
by skazat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |