357 sub run_on_wait { my ($s,$code, $period)=@_; 358 $s->{on_wait}=$code; 359 $s->{on_wait_period} = $period; 360 } 361 362 sub on_wait { my ($s)=@_; 363 if(ref($s->{on_wait}) eq 'CODE') { 364 $s->{on_wait}->(); 365 if (defined $s->{on_wait_period}) { 366 local $SIG{CHLD} = sub { } if ! defined $SIG{CHLD}; 367 select undef, undef, undef, $s->{on_wait_period} 368 }; 369 }; 370 };