RE: Problems with data returned from Gtk2::SimpleList



Following up on my own post: 

AFAICT the check "$arg && SvOK ($arg)" is supposed to be
the XS equivalent of "defined $arg"? Apparently that's
broken for recent Perls when $arg is a tied variable.

Actually, "defined $arg" involves a lot more than just
testing SvOK($arg), here's the source for perl 5.8.8:

PP(pp_defined)
{
    dSP;
    register SV* const sv = POPs;

    if (!sv || !SvANY(sv))
        RETPUSHNO;
    switch (SvTYPE(sv)) {
    case SVt_PVAV:
        if (AvMAX(sv) >= 0 || SvGMAGICAL(sv)
                || (SvRMAGICAL(sv) && mg_find(sv, PERL_MAGIC_tied)))
            RETPUSHYES;
        break;
    case SVt_PVHV:
        if (HvARRAY(sv) || SvGMAGICAL(sv)
                || (SvRMAGICAL(sv) && mg_find(sv, PERL_MAGIC_tied)))
            RETPUSHYES;
        break;
    case SVt_PVCV:
        if (CvROOT(sv) || CvXSUB(sv))
            RETPUSHYES;
        break;
    default:
        if (SvGMAGICAL(sv))
            mg_get(sv);
        if (SvOK(sv))
            RETPUSHYES;
    }
    RETPUSHNO;
}

Cheers, Roderich



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]