LanX has asked for the wisdom of the Perl Monks concerning the following question:
We had many debugger questions lately which made me meditate about better ways to communicate features.
Before reinventing the wheel, are there any selfcontained solutions with standalone debugger demos which can be used to show and test features?
I was thinking of something semantically like (just an untested sketch)
sub testsub { print "inside"; } print "outside"; testsub(); use DB::Demo <<'__DB__'; > b testsub > r __DB__
which sets a breakpoint and runs it? (this is not meant as replacement for $DB::single )
FWIW I know perl5db's source command and I somehow remember a way to pass a queue of commands via afterinit in .perldb
-
You can mock TTY input to debugger by adding arbitrary commands to @DB::typeahead . For example, your .perldb file might contain:
sub afterinit { push @DB::typeahead, "b 4", "b 6"; }
Which would attempt to set breakpoints on lines 4 and 6 immediately after debugger initialization. Note that @DB::typeahead is not a supported interface and is subject to change in future releases.
So this can be done with temporary .perldb files, I'd rather avoid this with an embedded format.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery