in reply to Propagating errors in C code to Perl

Afaik you can die from C code using the "croak" function. Here's an example how to do it and set $@. Probably setting $! works similar (Update:) by setting errno (see Joost's post).

If you throw exceptions from C code, you just have to make sure that all your dynamically allocated memory is freed, which can be a problem in callbacks from external libraries.