class pppInterp { public: ......// a lot of methods here pppStack call(string subname, bool want_re, bool want_array); pppStack call(string subname, pppStack& args, bool want_re, bool want_array); protected: // the interpreter only has this one property static bool inited; PerlInterpreter* my_perl; } // // the method implementation // pppStack pppInterp::call(string subname, bool want_re, bool want_array) { pppStack empty; return call(subname,empty,want_re,want_array); } pppStack pppInterp::call(string subname, pppStack& args, bool want_re, bool want_array) { // enter sub SPAGAIN; ENTER; SAVETMPS; // push args PUSHMARK(SP); pppStack::iterator it; int arg_count = 0; for (it=args.begin(); it!=args.end(); it++) { SV* arg_copy = newSVsv((*it)->get_internal()); sv_2mortal(arg_copy); XPUSHs(arg_copy); arg_count++; } PUTBACK; // call sub I32 flags = G_EVAL; if (arg_count==0) flags |= G_NOARGS; if (!want_re) flags |= G_DISCARD; if (want_array) flags |= G_ARRAY; else flags |= G_SCALAR; int re_count = call_pv(subname.c_str(),flags); // check eval if (SvTRUE(ERRSV)) { if (want_array) POPs; throw(SvPV_nolen(ERRSV)); } // fetch args pppStack re; if (want_re) { SPAGAIN; int i; for (i=0; i