SP -= items; PUSHMARK(SP); SPAGAIN; /* these pass this set of args on */
int retvals = perl_call_method("new", G_SCALAR);
SPAGAIN;
if (retvals != 1) barf("new returned no values");
RETVAL = POPs;
####
SV *
topdl(klass, arg1, ...)
SV *klass;
SV *arg1;
CODE:
if (items > 2 ||
(!SvROK(arg1) && SvTYPE(arg1) < SVt_PVAV) ||
(SvROK(arg1) && SvTYPE(SvRV(arg1)) == SVt_PVAV)
) {
SP -= items; PUSHMARK(SP); SPAGAIN; /* these pass this set of args on */
int retvals = perl_call_method("new", G_SCALAR);
SPAGAIN;
if (retvals != 1) barf("new returned no values");
RETVAL = POPs;
} else if (SvROK(arg1) && SvOBJECT(SvRV(arg1))) {
RETVAL = arg1;
} else {
barf("Can not convert a %s to a %s", sv_reftype(arg1, 1), SvPV_nolen(klass));
}
SvREFCNT_inc(RETVAL);
OUTPUT:
RETVAL
##
##
SP -= items; /* make the local SP point at our ST(0) */
PUSHMARK(SP); /* make the next function's ST(0) be that */
SPAGAIN; /* reset our local SP to the global "top of current stack" */
int retvals = perl_call_method("new", G_SCALAR); /* call method so has right stack frame */
SPAGAIN; /* set our local SP to the global "top of current stack" */
if (retvals != 1) barf("new returned no values"); /* use croak in non-PDL code */
RETVAL = POPs; /* set the SV* to the return value */