home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / p / perl4036.zip / os2 / alarm.pl next >
Text File  |  1993-02-08  |  353b  |  18 lines

  1. sub handler {
  2.   local($sig) = @_;
  3.   print "Caught a SIG$sig -- shutting down\n";
  4.   exit(0);
  5. }
  6.  
  7. $SIG{'ALRM'} = 'handler';
  8. $SIG{'INT'} = 'handler';    # Ctrl-C pressed
  9. $SIG{'BREAK'} = 'handler';    # Ctrl-Break pressed
  10. $SIG{'TERM'} = 'handler';    # Killed by another process
  11.  
  12. print "Starting execution ...\n";
  13. alarm(10);
  14.  
  15. while ( <> ) {
  16. }
  17. print "Normal exit.\n";
  18.