At 12:10 AM 8/16/00 -0500, Jonathan Scott Duff wrote:
>Why not have a special array that acts as an exception stack and each
>exception knows what file/line/whatever? Then you can get both behaviors
>with a simple for loop:
>
> for (@PERL::EXCEPTIONS) {
> print $_->file, "\t", $_->line, "\n";
> }
Because there isn't a stack of exceptions; I'm talking about tracking the
movement of a single exception.
This feature gets repeatedly confused with the RFC 88 exception stacking
feature.
What I want is to know the program location an exception was thrown at and
the locations it pased through on its way baack to me. Because it may be
thrown in a module that I wrote, in which case I want to see that, or it
may be thrown in a module I didn't write, in which case I want to see the
line of my code that called the piece of code that was responsible.
This is orthogonal to the RFC 88 exception stack which says that while
you're handling one exception, you can throw another which gets the
previous one linked to it, so the outer levels can see a cascade of reasons
ranging from primitive to advanced, e.g. "unable to open /etc/passwd -
permission denied" causes "unable to update home directory" causes "unable
to modify user account" causes "unable to make global change - rolling back".
We can have both of these features. I still think the file and line arrays
are best for the first one.
--
Peter Scott
Pacific Systems Design Technologies