|
|
| P is for Practical | |
| PerlMonks |
Preventing BEGIN blocks from being run in the debugger?by bikeNomad (Priest) |
| on May 25, 2001 at 05:43 UTC ( #83207=perlquestion: print w/ replies, xml ) | Need Help?? |
|
bikeNomad has asked for the
wisdom of the Perl Monks concerning the following question:
It is said in the Holy Books that the only program that can correctly parse Perl is Perl itself. I have taken this teaching to heart and have written a twisted little Perl tags generator (like ctags) that does not attempt to parse the Perl text itself. I have put it in Craft here. Instead, it runs as a Perl debugger, which gives it access to the tables of symbols and line numbers that debuggers have access to. And it works quite well.
Except for one thing: anything in a BEGIN (or probably also INIT) block gets run. If these blocks print to STDOUT they mess up the tags file. Now I guess I could just use another file handle to write to and hope that the BEGIN blocks don't have nasty side effects, but does anyone know how I can gain control before the BEGIN blocks run? (I've tried adding the line BEGIN { $DB::single=1 } to the end of the PERL5DB env var but it didn't help)
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||