package My::Module; local $SIG{ALRM} = sub { # initialize stuff }; alarm(20);