Tassilo von Parseval wrote:
> > >   SAVESPTR(DEFSV);
> > 
> > or in other words SAVE_DEFSV
> 
> I read this in pp_grepstart:
> 
>     /* SAVE_DEFSV does *not* suffice here for USE_5005THREADS */
>     SAVESPTR(DEFSV);

We're not reading the same sources :)
in bleadperl you have
    #define DEFSV GvSV(PL_defgv)
    #define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv))
in perl.h. (and references to 5005threads have been removed)

> so I used it, too. Of course, I am not yet using pTHX_ which I probably
> would have to in this case.
> 
> > >   ENTER;
> > >   SAVETMPS;
> > >   PUSHMARK(SP);
> > >   DEFSV = sv_2mortal(newSVpvn(path, strlen(path)));
> > >   PUTBACK;
> > >   (void) call_sv(coderef, G_DISCARD);
> > >   
> > >   FREETMPS;
> > >   LEAVE;
> > >     }
> > 
> > That looks correct to me.
> 
> Cool.
> 
> > A caveat, though: this will not work with a lexical $_ in perl 5.9.x.
> > DEFSV is always $::_. With a lexical $_ (you can know whether there is
> > one by looking it up in the pad) you have to replace SAVE_DEFSV by
> > SAVESPTR(PAD_SVl(padoffset_of_dollarunderscore)). Grep bleadperl for
> > details.
> > 
> > Hmm, maybe this means that a _new_ macro should be added for XS
> > writers, that get DEFSV right, by testing whether there's a lexical $_
> > in scope. Opinions ?
> 
> Well, yes, please! Ideally, it would be backwards-compatible so that
> people could already start using it now (unless of course they
> deliberately want $::_).

That's the job of PPPort, isn't it.

Reply via email to