Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Perl
Perl Misc
Checking the syntax of Perl code
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Uri Guttman, post: 4838151"] S> I have written a code generator (in Perl) that produces Perl code and S> would like to throw an assertion if the result contains invalid S> syntax. Any idea if there is a way to perform a syntax check that does S> not involve firing up a new process with "perl -c" or eval? how were you planning on actually compiling this code? if you want it inside this process you have to use eval STRING. note that any code outside of subs will be executed. externally you can run perl -c and it won't execute main level code but use commands will be run and those modules can execute code. so there really is no way to just test for perl syntax all by itself. if you want to see how generated code is evaled and used, check out Sort::Maker on cpan. it is a very rare problem that needs code generation and it can be tricky doing it right. why do you think you need code gen for your problem? i saw one case where someone generated code for class accessors when closures would have been simpler and better. uri [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Perl
Perl Misc
Checking the syntax of Perl code
Top