perl -e 'my $ccc = 0; $SIG{INT} = sub { $ccc++; print "^C pressed $ccc + times\n"; exit 42 if $ccc >= 5 }; 1 while 1;'; echo $?
my $parentFlag; my $pid = fork(); if ($pid) { #parent process $parentFlag= 1; } elsif (defined $pid) { #child process $parentFlag= 0; } else { #error on fork die "some useful message: $!\n"; } END { if ($parentFlag) { #parent end code } elsif (defined $parentFlag) { #child end code } else { #end block after failed fork or exit before the fork? } }
In reply to Re: fork, %SIG, END.
by Ven'Tatsu
in thread fork, %SIG, END.
by eff_i_g
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |