[33007] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4283 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 13 14:09:14 2014

Date: Sat, 13 Sep 2014 11: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           Sat, 13 Sep 2014     Volume: 11 Number: 4283

Today's topics:
    Re: Devel::Peek's character count (or bytes, maybe?) <hjp-usenet3@hjp.at>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 13 Sep 2014 19:56:16 +0200
From: "Peter J. Holzer" <hjp-usenet3@hjp.at>
Subject: Re: Devel::Peek's character count (or bytes, maybe?)
Message-Id: <slrnm191a0.ppu.hjp-usenet3@hrunkner.hjp.at>

On 2014-09-12 19:41, G.B. <bauhaus@futureapps.invalid> wrote:
> $ 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
[...]
> Is CUR the number of bytes as opposed to Perl characters, currently
> present in ${a}'s PV up to \0?

Yes.

> (The docs say "characters" for CUR,
> do they mean C characters?)

Probably. Or "the docs" (you don't say which docs) haven't been updated
since 5.005.

The length in characters is cached in special magic block:

% perl -w -e 'use Devel::Peek; $a = "\x{20AC}"; $x = length($a); Dump($a);'
Name "main::x" used only once: possible typo at -e line 1.
SV = PVMG(0x8674888) at 0x86540b0
  REFCNT = 1
  FLAGS = (SMG,POK,IsCOW,pPOK,UTF8)
  IV = 0
  NV = 0
  PV = 0x8659e50 "\342\202\254"\0 [UTF8 "\x{20ac}"]
  CUR = 3
  LEN = 10
  COW_REFCNT = 1
  MAGIC = 0x864f020
    MG_VIRTUAL = &PL_vtbl_utf8
    MG_TYPE = PERL_MAGIC_utf8(w)
    MG_LEN = 1

        hp

-- 
   _  | Peter J. Holzer    | Fluch der elektronischen Textverarbeitung:
|_|_) |                    | Man feilt solange an seinen Text um, bis
| |   | hjp@hjp.at         | die Satzbestandteile des Satzes nicht mehr
__/   | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel


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

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 4283
***************************************


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