Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Debugging Perl scripts which use fork()

by dash2 (Hermit)
on Feb 28, 2003 at 14:49 UTC ( #239443=note: print w/ replies, xml ) Need Help??


in reply to Debugging Perl scripts which use fork()

Ilya,

Great article, really useful. I think cybear was joking btw.

One thing that tripped me up when trying to send multiple processes to a series of ttys: DB::get_fork_TTY is called from the child, after the fork. So, this won't work:

{ my $ttyno = 1; sub DB::get_fork_TTY{ $DB::fork_TTY = "/dev/pts/" . $ttyno++; } }

because the $ttyno is in separate processes. Instead, redefine your $ttyno after the fork:

use vars $ttyno; for my $fork (0 .. $forks) { if (fork) { } else { # in child $ttyno = $fork; } } sub DB::get_fork_TTY { $DB::fork_TTY = "/dev/pts/" . $main::tty; }

dave hj~


Comment on Re: Debugging Perl scripts which use fork()
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://239443]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2014-12-21 02:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (101 votes), past polls