Skip to Content
Perl Debugged
book

Perl Debugged

by Peter Scott, Ed Wright
March 2001
Intermediate to advanced
288 pages
4h 56m
English
Addison-Wesley Professional
Content preview from Perl Debugged

9.4. Playing Catch-Up

Let's say that you want to go in the other direction and instead of turning errors into exceptions, you want to know when your program is about to die. The brute-force approach is to define a pseudo signal handler for __DIE__:

$SIG{__DIE__} = sub { print "Igor lives!\n" };

but this is rather ineffectual for several reasons. First, we don't know why the program is dying (without parsing the argument, which is an arbitrary string). Second, we don't know where the program is dying without parsing the line number out of the argument (but when you think about it, that information is absolutely useless inside your program). And third, the Faustian bargain that this handler has made lasts only as long as it does; as soon as the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Perl Hacks

Perl Hacks

Chromatic, Damian Conway, Curtis Ovid Poe, Curtis (Ovid) Poe
Pro Perl

Pro Perl

Peter Wainwright
Intermediate Perl

Intermediate Perl

Randal L. Schwartz, brian d foy, Tom Phoenix
Perl Testing: A Developer's Notebook

Perl Testing: A Developer's Notebook

Ian Langworth, Chromatic

Publisher Resources

ISBN: 0201700549Purchase book