Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: How to do perl -c inside perl? (op-hook)by tye (Sage) |
on Aug 31, 2012 at 04:56 UTC ( [id://990916]=note: print w/replies, xml ) | Need Help?? |
I just realized that this may be quite easy to implement using existing features. Where 'this' is to run 'eval' in order to check for syntax errors while preventing any code from being run, even if a form of 'BEGIN' is used in the code. I believe that there are ways to hook Perl's "run loop". So the steps would be:
Unfortunately, I don't know how you hook Perl's run-loop. And there might be complications to overcome when getting into the details of making this work. But I can see real value in such a feature. Disabling the running of code may be as simple as just defining "sub DB::sub" and "sub DB::DB" (you probably need to put your code that calls eval() into 'package DB' so it wouldn't be subject to the debugging hooks). But you can also look at what Enbugger does to enable debugging or what Devel::NYTProf does to profile opcodes. - tye
In Section
Seekers of Perl Wisdom
|
|