Hi, 

I hope this post is in the right place, I couldn't find an embedded perl
list but my question is also related to xs.  If anyone knows a more
appropriate list could they please let me know? Thanks.

I'm embedding PERL into my C++ app to act as a scripting interface for
users. callbacks to the internal C/C++ routines are via XS.  In some cases I
also use the PERL instance to evaluate expressions entered by the user and
this is where i'm experiencing a problem:

As per the perlcall docs I generate a pointer to an anonymous sub routine
using
        
         'SV *cvrv = eval_pv("......",TRUE)'

Then mess with the stack before "call_sv(cvrv,G_ARRAY)" and then more
messing with the stack to get the result.

This all works fine until the user enters an invalid expression which i then
attempt to compile.  I couldn't find any docs describing how to handle this
but I've found (through playing with the debugger) that "cvrv->sv_any" will
be NULL if the compilation fails.  Firstly is this the best (only?) way to
extract success/fail info (it's undocumented and therefore i dont want my
code to break with an updates etc) and secondly how can i return the useful
compilation error message from the PERL interpreter? (i.e. "Scalar found
where.....")

I've looked through perlguts, perlapi and perlcall - any other ideas????

Many thanks,

Rich


Reply via email to