Hi,

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.
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";};
The below is the corresponding sample .XS function for this call:-
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.


In reply to cpan 5.24.3 The interface now has an additional optional argument by mukeshp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.