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