On Friday, December 13, 2002, at 08:17  AM, David Wheeler wrote:

On Friday, December 13, 2002, at 01:17  AM, Tim Bunce wrote:

Actually I meant just a copy of the reference. Then add accessor methods
to lookup the value from the handle. Would be much faster as few uses would
access all those attributes.
Ah, yes, excellent point.

An extra method to 'freeze' (copy) the attributes could be added
and called in situations where the exception object would be longlived
and the user wanted to protect against the underlying handle attributes changing.
Again, good point.
Looking at it again (it has been a while since I wrote this code), I see that the reason I'm not simply caching a reference to the DBI handle is that I was relying on Exception::Class, from which Exception::Class::DBI inherits, to handle all the accessors and such. All the values have be passed to the initialization of the object. I think that The idea was that all the values are supposed to be frozen at the time the exception is thrown (important for attributes such as C<time>).

I could create my own accessors and such, of course, and maybe I will at some point. But I think I'll just leave it as-is for now. Most folks aren't going to be too concerned about performance when an exception is thrown -- they just have to wait for it to die.

Regards,

David

--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED] ICQ: 15726394
http://david.wheeler.net/ Yahoo!: dew7e
Jabber: [EMAIL PROTECTED]

Reply via email to