http://qs321.pair.com?node_id=761106

McD has asked for the wisdom of the Perl Monks concerning the following question:

Wandering amongst the dragons here, seeking insight from the wizards.

Suppose I'm embedding Perl in my C app, as is so well documented in perlembed. I've constructed a PerlInterpreter my_perl, parsed my Perl code, and I'm occasionally calling call_argv("MyPerlFunction", ...);.

My question is this: is it possible, in my C app, to save off the state of the interpreter and restore it later?

I'm thinking of something like serializing my_perl, perhaps to disk, and restoring it later - thus saving not only the parsing/compiling, but more importantly, saving the state of things like Perl variables, etc.

I've read the docs and searched the net, but so far I'm coming to the conclusion that this may not be feasible with the API provided - I'd have to hack the perl library itself to provide a serialization interface, which might be a bridge too far.

What say ye, oh deep hackers?