develooper Front page | perl.perl5.porters | Postings from October 2011

Fun bug: substr can empty string without resetting offset

Thread Next
From:
Chip Salzenberg
Date:
October 10, 2011 15:48
Subject:
Fun bug: substr can empty string without resetting offset
Message ID:
CANSL5VGgEPiaessB1bFdA+Xvq8VHLH5hpSqio+2v+Aw7VpVyug@mail.gmail.com
$ perl -MDevel::Peek -e '$x = "hello"; substr $x,0,5,""; Dump($x); $x .=
"x"; Dump($x)
SV = PV(0x9b4f824) at 0x9b6b410
  REFCNT = 1
  FLAGS = (POK,OOK,pPOK)
  OFFSET = 5
  PV = 0x9b7a161 ( "\\]^_\5" . ) ""\0
  CUR = 0
  LEN = 3
SV = PV(0x9b4f824) at 0x9b6b410
  REFCNT = 1
  FLAGS = (POK,OOK,pPOK)
  OFFSET = 5
  PV = 0x9b7a161 ( "\\]^_\5" . ) "x"\0
  CUR = 1
  LEN = 3

still in blead.  I'll patch it

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