home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!sun-barr!ames!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!usc!news!netlabs!lwall
- From: lwall@netlabs.com (Larry Wall)
- Newsgroups: comp.lang.perl
- Subject: Re: How do I make traps in perl?
- Message-ID: <1992Aug28.190101.9961@netlabs.com>
- Date: 28 Aug 92 19:01:01 GMT
- References: <1992Aug26.135146.1759@linda.lidac.liu.se>
- Sender: news@netlabs.com
- Organization: NetLabs, Inc.
- Lines: 16
- Nntp-Posting-Host: scalpel.netlabs.com
-
- In article <1992Aug26.135146.1759@linda.lidac.liu.se> thenglid@linda.lidac.liu.se (Thomas Engstrom) writes:
- : Is there anyone that knows how to catch signals in perl? Something like
- : "trap" in bourne shell.
-
- $SIG{"INT"} = "CATCHINT";
- ...
-
- sub CATCHINT {
- print "OUCH! Don't DO that!!!\n";
- }
-
- Nowadays I often just write
-
- $SIG{INT} = CATCHINT;
-
- Larry
-