in reply to Debugging Perl scripts which use fork()
When perl5db.pl starts, it reads an rcfile (perl5db.ini for non-interactive sessions, .perldb for interactive ones) that can set a number of options. In addition, this file may define a subroutine afterinit that will be executed (in the debugger's context) after the debugger has initialized itself. This can be set in the options, or by setting it in .perldb.afterinit() runs a little too late - after TTY allocation - so you can't do the TTY mojo there. However, .perldb gets control right after option processing, and just before the get_fork_TTY subroutine is checked for and called, so it's an optimum point to set this up if you don't want to use another module to do it.
You can of course use a module that defines DB::get_fork_TTY in .perldb as well, if you prefer to have all your magic in one place, so to speak.
Another item of note is the $DB::CreateTTY variable, which controls when the debugger decides to try grabbing a new TTY (this is a bit-field scalar, so if you want more than one option, you sum them):
- 1 - on fork()
- 2 - when debugger is started inside the debugger
- 4 - on startup