develooper Front page | perl.perl5.porters | Postings from December 2002

Re: [PATCH] operation on `PL_na' may be undefined

Nicholas Clark
December 12, 2002 13:49
Re: [PATCH] operation on `PL_na' may be undefined
Message ID:
Sorry about the delay in replying to the original question.
On Wed, Dec 11, 2002 at 11:28:48AM -0500, John Peacock wrote:
> Rafael Garcia-Suarez wrote:
> >%_ : placeholder for an SV that will get stringified. See sv_vcatpvfn() in 
> >sv.c.
> >I can't find doc on this in the perl sources, but there a small paragraph
> >about it in the Cozens & Jenness.

I can't find any docs either. In fact, a straight grep on %_ in the
current sources is most unrewarding.

> Neat!  Is it supported in 5.005???

Well, I had a grep in the 5.004_04 sources and it's in there quite a lot,
such as:

    if (in_eval & 2)
        warn("%_", msg);
    else if (in_eval)
        sv_catsv(GvSV(errgv), msg);

so I wondered what had happened to them all. The same piece of code is now:

    if (PL_in_eval & EVAL_WARNONLY)
        Perl_warn(aTHX_ "%"SVf, msg);

with this in perl.h

#ifndef SVf
#    define SVf "p"
#  else
#    define SVf "_"
#  endif

That doesn't seem to be in Devel::PPort (yet - patches welcome I guess)

I wonder how many parts of the perl core can be reduced slightly in size
by changing %s SvPV_nolen(sv) to %_ sv.
This would have the beneficial side effect of making the non-error code path
more direct, which might have a slight speed gain.

It's not in 5.003_07's sources, but I don't think anyone really supports that
any more.

Nicholas Clark Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About