We had the script userprops.t which was running fine in 5.22.1 version, but after upgrading to cpan 5.24.3, we see following error :- "Certificatefailed2() failed with error -2. The interface now has an additional optional argument. at ..userprops.t line 62".
Here is the snapshot of userprop.t which call following function.The below is the corresponding sample .XS function for this call:-62 ($data[0],$len[0]) = $users[0]->Certificate(); 63 if(!(defined $data[0]) && !(defined $len[0])) {print "ok 5\n";} els +e {print "not ok 5\n";};
void Certificate(pSelf,...) t_testapi_usrcreds * pSelf PPCODE: int certBinaryLen = 0; int ret = 0; char* certificate = NULL; // look for optional returnCode arg SV *rval = ST(3); InitError(items, 3, rval); if (items > 2){ certificate = SvPV_nolen(ST(1)); certBinaryLen = (int)SvIV(ST(2)); if(certificate) { /* Cert is to be set */ }else{ /* Couldn't properly read an argument */ HandleError("Certificate1", items, 3, rval, -1); XSRETURN_UNDEF; } } if(!pSelf->credStruct.lpszCertBinary){ /* The certificate data is not set. */ HandleError("Certificatefailed2", items, 3, rval, -2); XSRETURN_UNDEF; } /* Return certificate currently set */ EXTEND(SP,2); PUSHs(sv_2mortal(newSVpv(pSelf->credStruct.lpszCertBinary,0))); PUSHs(sv_2mortal(newSViv((IV)pSelf->credStruct.nCertBinaryLen ) +)); XSRETURN(2);
void HandleError(char *func, int numArgs, int errorArg, SV *errorSV, i +nt errorCode) { if (numArgs==errorArg+1 && !SvREADONLY(errorSV)) { // new interface: set return code sv_setiv(errorSV, errorCode); } else { // old interface: die with error code and deprecation notifica +tion croak("%s() failed with error %d. The interface now has an add +itional optional argument.", func, errorCode); } }
It is failing when call is returning undef XSRETURN_UNDEF. Does the XSRETURN_UNDEF handling got changed in 5.24.3 version or.? How come the croak changed with upgradation of perl. How to come over this error, this breaking at multiple places in our scripts.
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |