unsubscribe please- thanks
-----Original Message-----
From: Matt Sergeant [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 30, 2001 4:29 PM
To: Jeffrey W. Baker
Cc: [EMAIL PROTECTED]
Subject: Re: Exception modules
On Mon, 30 Apr 2001, Jeffrey W. Baker wrote:
>
>
> On Mon, 30 Apr 2001, Matt Sergeant wrote:
>
> >
> > > [1] for my Perl exception package (yes, another one :) which, in its
> > > development version, now mostly does the Right Thing for mod_perl. See
> > > http://sourceforge.net/projects/perlexception/ for the curious.
> >
> > Since I'm doing the mod_perl exception handling talk at TPC, I feel
> > obligated to ask about this...
> >
> > It doesn't seem any different from Error.pm to me, except in syntax. Maybe
> > you could expand on why/where it is different?
>
> I tried using some different exception packages in the past. What I
> realized is, die() and eval {} ARE Perl's exception handling mechanism.
> die() and eval {}, together, have complete exception throwing and handling
> functionality. As a bonus, they lack Java's exception bondage and
> discipline.
>
> So, what's wrong with die() and eval {}?
Nothing, IMHO. In fact I've now switched away from using Error.pm's
try/catch syntax, because it creates closures and it's really easy to
generate memory leaks that way with mod_perl. But I still use Error.pm's
exception object structure...
Without some sort of structured exception handling, you don't know exactly
what type of exception was thrown. For example, in AxKit I need to know in
certain places if an IO exception occured, or if it was some other kind of
exception. I could do this with regexps, but then I'm relying on people
using the right strings in their error messages. Plus exception objects
can give you a stack trace, which eval catching a string can't (well, it
kinda can in a few ways, but not in quite as clean a manner).
Try it though, you might be surprised you like it. (unless by die() and
eval{} you mean you're already using exception objects, in which case I'm
preaching to the choir ;-)
--
<Matt/>
/|| ** Founder and CTO ** ** http://axkit.com/ **
//|| ** AxKit.com Ltd ** ** XML Application Serving **
// || ** http://axkit.org ** ** XSLT, XPathScript, XSP **
// \\| // ** mod_perl news and resources: http://take23.org **
\\//
//\\
// \\