[33006] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4282 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 12 16:09:16 2014

Date: Fri, 12 Sep 2014 13:09:03 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 12 Sep 2014     Volume: 11 Number: 4282

Today's topics:
        Devel::Peek's character count (or bytes, maybe?) <bauhaus@futureapps.invalid>
    Re: Devel::Peek's character count (or bytes, maybe?) <rweikusat@mobileactivedefense.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 12 Sep 2014 21:41:27 +0200
From: "G.B." <bauhaus@futureapps.invalid>
Subject: Devel::Peek's character count (or bytes, maybe?)
Message-Id: <luvi95$kmc$1@dont-email.me>

Hi,

starting here, looking for CUR:

$ perl -w -e 'use Devel::Peek; $a = "\x{20AC}"; Dump($a);'
SV = PV(0x7fe8f2003080) at 0x7fe8f202ddd8
   REFCNT = 1
   FLAGS = (POK,pPOK,UTF8)
   PV = 0x7fe8f1c0d980 "\342\202\254"\0 [UTF8 "\x{20ac}"]
   CUR = 3
   LEN = 16

just to make sure, see the same for two occurrences of "\x{20AC}"

$ perl -w -e 'use Devel::Peek; $a = "\x{20AC}\x{20AC}"; Dump($a);'
SV = PV(0x7fe883003080) at 0x7fe88302ddd8
   REFCNT = 1
   FLAGS = (POK,pPOK,UTF8)
   PV = 0x7fe882c0d980 "\342\202\254\342\202\254"\0 [UTF8 
"\x{20ac}\x{20ac}"]
   CUR = 6
   LEN = 16

Is CUR the number of bytes as opposed to Perl characters, currently
present in ${a}'s PV up to \0? (The docs say "characters" for CUR,
do they mean C characters?)


------------------------------

Date: Fri, 12 Sep 2014 20:59:35 +0100
From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Subject: Re: Devel::Peek's character count (or bytes, maybe?)
Message-Id: <87ha0cvcd4.fsf@sable.mobileactivedefense.com>

"G.B." <bauhaus@futureapps.invalid> writes:
> starting here, looking for CUR:
>
> $ perl -w -e 'use Devel::Peek; $a = "\x{20AC}"; Dump($a);'
> SV = PV(0x7fe8f2003080) at 0x7fe8f202ddd8
>   REFCNT = 1
>   FLAGS = (POK,pPOK,UTF8)
>   PV = 0x7fe8f1c0d980 "\342\202\254"\0 [UTF8 "\x{20ac}"]
>   CUR = 3
>   LEN = 16
>
> just to make sure, see the same for two occurrences of "\x{20AC}"
>
> $ perl -w -e 'use Devel::Peek; $a = "\x{20AC}\x{20AC}"; Dump($a);'
> SV = PV(0x7fe883003080) at 0x7fe88302ddd8
>   REFCNT = 1
>   FLAGS = (POK,pPOK,UTF8)
>   PV = 0x7fe882c0d980 "\342\202\254\342\202\254"\0 [UTF8
> "\x{20ac}\x{20ac}"]
>   CUR = 6
>   LEN = 16
>
> Is CUR the number of bytes as opposed to Perl characters, currently
> present in ${a}'s PV up to \0?

CUR is the actual length of the SVPV (scalar holding a string) and LEN
is the size of the currently allocated char array. perl always keeps a
trailing 0 at the end of any string.


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 4282
***************************************


home help back first fref pref prev next nref lref last post