Markus Peter wrote:
> --On 22.08.2000 10:48 Uhr -0700 Glenn Linderman wrote:
>
> What
> I was talking about is that I cannot imagine that the perl core itself
> magically transforms exceptions into return values as someone else
> requested.
We agree here.
> > "enabling/disabling fatality for exceptions with a pragma"... if the idea
> > is that control continues linearly past a throw, then sub/module authors
> > must write twice the error handling logic, which is painful. If it means
>
> No - the sub returns as if it has correctly thrown the exception, but if
> the exception really propagates to the top most level, it will be ignored
> instead of die'ing. This is really the same as a try/catch block around my
> whole program just not that ugly.
Ah. With RFC 119 syntax, you simply code
catch {};
at the end of your main routine. But then you will exit instead of die'ing.
I'm suddenly intuiting that maybe you want to continue execution after the sub
call that caused the throw. But if you continue, you won't have the return
values from the sub call. Where should the continuation take place for
something like:
l1:
$a = & foo ( & bar ( $b ));
l2:
& baz ( $a );
l3:
in the two different cases that &bar throws, and that &foo throws? If you
continue "immediately after" the sub call, and &bar throws, &foo is likely to
get bad parameters and also fail. And if you say the next statement after a
throw, then &baz isn't going to get a good value for its parameter... if the
user places the catch phrase to explicitly ignore the error, then there is a
target than can be presumed to be good to the compiler. Otherwise, we reach the
end of the program anyway, and all you've suppressed is the error message ???
Still something I'm not understanding about what you want.
> What I was actually requesting was a small pragma which simply turns off
> all fatality, in the whole program, similar to what $SIG{__DIE__} currently
> is able to do, without the need to span a try/catch block across my whole
> main program - I simply do not like the look and feel of that. Even though
> this has global effects, it's not necessarily evil, we should only ensure
> that it cannot be used from within a .pm
--
Glenn
=====
There are two kinds of people, those
who finish what they start, and so
on... -- Robert Byrne
_____NetZero Free Internet Access and Email______
http://www.netzero.net/download/index.html