tfoertsch has asked for the wisdom of the Perl Monks concerning the following question:
Suppose I have a perl callback that is called from C level like this
call_sv((SV*)my_callback, G_VOID|G_DISCARD|G_EVAL); if (SvTRUE(ERRSV)) { /* do something */ croak("%s", SvPV_nolen(ERRSV)); }
This code works if $@ is a string. But if $@ is an object it is converted into a string.
I'd like to use in my_callback code like this:
die My::Error->new(...);
and catch the object, not it's stringification later in perl again. So I need to reraise the exact $@ object in C.
Thanks,
Torsten
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to correctly reraise an exception in XS?
by tfoertsch (Beadle) on May 19, 2007 at 16:03 UTC |