I'm developing some application on C using perlembed.
Main idea is loading a .pm module with perl_parse() and then call a sub with call_argv().
Got a problem while trying to prevent sub from calling exit() because it terminates main C program. Now I'm trying to prevent exiting with eval
but this not working (if I place this line before perl_parse() - it leads to segfault, but after perl_parse() it is gives no effect (program terminates anyway))..
Construction is really work in 'clean perl', preventing exit.
But what I can do when I can't change .pm module?
Anyone have been working around this? Maybe I can change CORE::GLOBAL::exit sub to my own with sv_set* functions, but I can't find how to work with subs using this technique..
Tnx
Main idea is loading a .pm module with perl_parse() and then call a sub with call_argv().
Got a problem while trying to prevent sub from calling exit() because it terminates main C program. Now I'm trying to prevent exiting with eval
Code:
eval_pv("*CORE::GLOBAL::exit = sub{ print 'exit called'; }", TRUE);
Construction is really work in 'clean perl', preventing exit.
Code:
BEGIN { *CORE::GLOBAL::exit = sub{ print 'exit called'; } }
Anyone have been working around this? Maybe I can change CORE::GLOBAL::exit sub to my own with sv_set* functions, but I can't find how to work with subs using this technique..
Tnx