Error/exception handling (was: Re: Perl spontaneously jumps to other Perl code) 
Author Message
 Error/exception handling (was: Re: Perl spontaneously jumps to other Perl code)

Quote:
> Urgh. Blush. Embarassed.

> Uncaught die exceptions in evals...

Okay, I realize that I have unconsciously had a C++, LISP, or even Ada exception handling model
in my mind, as opposed to Perl's eval model - which is a slight improvement on C's.

I.e. Perl by default "catches" and ignores any exception generated inside an eval (by die).

it is legitimate for your eval to return undef, as happens to be in my design, since
I am using undef for SQL 'NULL' values), and then do further handling.

Unfortunately, I have lots of eval sites, since my evals need access to lexically scoped variables.
(If Perl had macros, I would use a macro...)

I.e. Perl is ignore by default inside eval,
optionally explicitly catch at eval site and arrange to propagate.

Q: is there anything that more closely approximates the C++/LISP/Ada strategy,
which I might summarize as
"don't ignore by default; propagate by default;
optionally explicitly catch at XXX site and optionally ignore at XXX site"?

{Where XXX site = catch/throw for LISP, or try/accept site for C==, and I forget what for Ada.}

I.e. is there a Perl exception mechanism which is conservative by default,
not optimistic by default?

----

(And, while we are at it, can anyone point me to any other exception/error handling models;
these are a longstanding interest of mine.)

---

Please respond by email,
in addition to replying to these newsgroups.



Tue, 30 Jan 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Error/exception handling (was: Re: Perl spontaneously jumps to other Perl code)

2. A useful example for Perl (was Re: Which language can write this but Perl)

3. A useful example for Perl (was Re: Which language can write this but Perl)

4. My Perl to Ruby Story (was: perl and rub y)

5. Scheme in Perl, or Perl as Scheme

6. Python and Perl (was: converting perl to python)

7. Perl vs TCL (was: Execution speed of Perl?)

8. awk to perl syntax errors

9. CGI Error - incomplete header - NT, IIS, perl

10. Perl, Javascript code help

11. ANN: bridgekeeper 0.0.1 - a Perl to Python source code converter

12. Turn your Scheme code into Perl/Python/Tcl

 

 
Powered by phpBB® Forum Software