Commit | Line | Data |
---|---|---|
9b5c3821 MHM |
1 | #include "EXTERN.h" |
2 | #include "perl.h" | |
3 | ||
4 | #define NO_XSLOCKS | |
5 | #include "XSUB.h" | |
6 | ||
7 | static void throws_exception(int throw_e) | |
8 | { | |
9 | if (throw_e) | |
10 | croak("boo\n"); | |
11 | } | |
12 | ||
b7b1e41b PA |
13 | /* Don't give this the same name as execution() in ext/Devel/PPPort/module3.c |
14 | as otherwise building entirely statically will cause a test to fail, as | |
7a646707 NC |
15 | PPPort's execption() gets used in place of this one. */ |
16 | ||
17 | int apitest_exception(int throw_e) | |
9b5c3821 MHM |
18 | { |
19 | dTHR; | |
20 | dXCPT; | |
21 | SV *caught = get_sv("XS::APItest::exception_caught", 0); | |
22 | ||
23 | XCPT_TRY_START { | |
24 | throws_exception(throw_e); | |
25 | } XCPT_TRY_END | |
26 | ||
27 | XCPT_CATCH | |
28 | { | |
29 | sv_setiv(caught, 1); | |
30 | XCPT_RETHROW; | |
31 | } | |
32 | ||
33 | sv_setiv(caught, 0); | |
34 | ||
35 | return 42; | |
36 | } | |
37 |