Sorry - I forgot to ask again.
If I need to check for the blessed types before / instead of blindly applying UNIVERSAL::isa,
I also need to know::


Would all exceptions from Sleepycat::DbXml be XmlException / std::exception
or is there some thing else I would need to check for?

I'm also assuming that all AxKit ones would match 'Apache::AxKit::Exception' (?)

Thanks

Mike

Mike Trotman wrote:


Oh, and a caution about UNIVERSAL::isa():  It can only be called by a
blessed reference and will panic (ie, even an eval won't keep the
program going) if you try to call it with an unblessed variable.  If
you're not absolutely sure that what you're getting is blessed, it's
better to use something like "if( ref $foo && ref $foo == 'bar')".
Unfortunately, while perl's C API has a function for detecting the
blessedness of a variable, it isn't (AFAIK) exposed to perl code
(though I suppose one could write a simple xs to do so).


Thanks John - I will test for a ref() 1st and then check what sort of ref.
I'm planning something like


if (ref($@)) {
if (UNIVERSAL::isa($@,'Error') {
return $@;
}
elsif (UNIVERSAL::isa($@,'XmlException')) {
return Apache::AxKit::Exception->new(-text=>'[EMAIL PROTECTED]>what()');
}
elsif (UNIVERSAL::isa($@,;std::exception')) {
return Apache::AxKit::Exception->new(-text=>'[EMAIL PROTECTED]>what()');
}
else {
return Apache::AxKit::Exception->new(-text=>'Unknown Exception :'.ref($@)); }
else {
return Apache::AxKit::Exception->new(-text=>'$@');
}



Regards,
John Ralls



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.6 - Release Date: 06/05/2005


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to