On Mon, Jul 31, 2000 at 09:44:54AM +0100, Andy Wardley wrote: > Can anyone point me at the right way to die/croak with an object > reference from XS? croak() accepts printf() like parameters and > I can't find anything in perlapi, perlguts, perlcall, perlxs or > perlxstut to enlighten me as to how I might throw an object reference. Well pp_die does this, it probably should be extracted out SV *error = ERRSV; (void)SvUPGRADE(error, SVt_PV); if (multiarg ? SvROK(error) : SvROK(tmpsv)) { if (!multiarg) SvSetSV(error,tmpsv); else if (sv_isobject(error)) { HV *stash = SvSTASH(SvRV(error)); GV *gv = gv_fetchmethod(stash, "PROPAGATE"); if (gv) { SV *file = sv_2mortal(newSVpv(CopFILE(PL_curcop),0)); SV *line = sv_2mortal(newSVuv(CopLINE(PL_curcop))); EXTEND(SP, 3); PUSHMARK(SP); PUSHs(error); PUSHs(file); PUSHs(line); PUTBACK; call_sv((SV*)GvCV(gv), G_SCALAR|G_EVAL|G_KEEPERR); sv_setsv(error,*PL_stack_sp--); } } DIE(aTHX_ Nullch); i.e. Set $@ to the reference then call DIE with Nullch for the message. Graham.Thread Previous