in reply to Take over STDOUT / STDERR for Perl embedded in C application

First thought is to do "wrap" the text to be evaluated like this:

string s = "local *STDOUT; local *STDERR; open(STDOUT, \$Hidden::stdou +t) or die \"Can't redirect STDOUT: $!\"; open (STDERR, \$Hidden::stde +rr) or die \"Can't redirect STDERR: $!\";\n" + code_from_user;
Then you should be able to access the scalars in the Hidden package.

But, then again, I've never done any sort of XS code to interface with perl. I've thought about it, but I've never actually done it.