develooper Front page | perl.perl5.porters | Postings from August 2001

Re: vstring guidance needed

Thread Previous | Thread Next
From:
Ronald J Kimball
Date:
August 20, 2001 08:08
Subject:
Re: vstring guidance needed
Message ID:
20010820110748.D39260@linguist.thayer.dartmouth.edu
On Mon, Aug 20, 2001 at 10:55:23AM -0400, John Peacock wrote:
> Rafael Garcia-Suarez wrote:
> > 
> > On 2001.08.20 15:21:01 +0200 John Peacock wrote:
> > > Actually, the bit in perl.c which sets up the $] system variables
> > > sets both PV and NV for the Perl version.  I'll be changing that to
> > > call the new_vstring code instead.
> > 
> > Beware : $] stores both an NV and a PV for performance only -- to avoid
> > conversions. This is similar to a SV that holds an NV and also has been
> > used in string context. With perl 5.6.1 :
> > 
> > $ perl -MDevel::Peek -e 'Dump $]'
> > SV = PVNV(0x80f1030) at 0x80fb160
> >   REFCNT = 1
> >   FLAGS = (NOK,POK,READONLY,pNOK,pPOK)
> >   IV = 0
> >   NV = 5.006001
> >   PV = 0x8100a60 "5.006001"\0
> >   CUR = 8
> >   LEN = 10
> > 
> > As you see the PV is not a version string. 
> 
> That's just the oversight I am considering fixing.

It's not an oversight; $] isn't intended to contain a version string!  If
you change it to hold a version string, you will break code that prints it
out.  (Oops, you didn't mean to print control characters?  Sorry...)

Ronald

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About