sub run_pre_fork { my ($s,$code)=@_; $s->{pre_fork}=$code; } sub pre_fork { my ($s)=@_; $s->{pre_fork}->() if ref($s->{pre_fork}) eq 'CODE'; }