home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!ogicse!psgrain!m2xenix!agora!merlyn
- From: merlyn@ora.com (Randal L. Schwartz)
- Newsgroups: comp.lang.perl
- Subject: Re: quick /*NOTREACHED*/ hack for perl ...
- Message-ID: <MERLYN.92Dec25095229@agora.rain.com>
- Date: 25 Dec 92 17:52:29 GMT
- Article-I.D.: agora.MERLYN.92Dec25095229
- References: <cameron-921222133520-1-21899@fuligin>
- Sender: merlyn@agora.rain.com (Randal L. Schwartz)
- Organization: Stonehenge Consulting Services; Portland, Oregon, USA
- Lines: 22
- In-Reply-To: cameron@cs.unsw.oz.au's message of Tue, 22 Dec 1992 02:35:42 GMT
-
- In article <cameron-921222133520-1-21899@fuligin> cameron@cs.unsw.oz.au writes:
- sub NOTREACHED { local($package,$filename,$line)=caller;
-
- die "$line of $filename (package $package) should not be reached";
- }
-
- Or, you could use something like:
-
- require 'assert.pl';
- sub NOTREACHED {
- &assert("0 NOT REACHED"); # the 0 makes assertion false
- }
-
- &NOTREACHED;
-
- which gives you a good stack traceback as well.
-
- sub NOTREACHED {print "Just another Perl hacker,";} &NOTREACHED;
- --
- Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
- merlyn@ora.com (semi-permanent) merlyn@agora.rain.com (for newsreading only)
- phrase: "Welcome to Portland, Oregon ... home of the California Raisins!"
-