Re: [perl #75812] kill $1 broken in 5.12.1

[email protected] (Eric Brine)
Newsgroups perl.perl5.porters
Message-ID <[email protected]>
On Thu, Jun 17, 2010 at 4:34 PM, Todd Rinaldo <[email protected]> wrote:

> Any idea why use 5.12.1 makes it so kill $1 doesn't break?
>
> use 5.12.1;
> my $pid = "12345  ";
> if($pid =~ m/(\d+)/) {
>        kill 9, $1;
> }
>
>
Because it places a numerical value in the PV of $1.

use 5.12.0;
use Devel::Peek;
my $pid = "12345  ";
Dump($1);
if($pid =~ m/(\d+)/) {
       Dump($1);
       kill 9, $1;
}

With "use 5.12.0;"
$ perl a.pl
SV = PVMG(0x8176904) at 0x817c560
  REFCNT = 1
  FLAGS = (GMG,SMG,pPOK)   <-----------
  IV = 0
  NV = 0
  PV = 0x81836f0 "5"\0   <-----------
  CUR = 1
  LEN = 4
  MAGIC = 0x8188880
    MG_VIRTUAL = &PL_vtbl_sv
    MG_TYPE = PERL_MAGIC_sv(\0)
    MG_OBJ = 0x817c550
    MG_LEN = 1
    MG_PTR = 0x81888a0 "1"
SV = PVMG(0x8176904) at 0x817c560
  REFCNT = 1
  FLAGS = (GMG,SMG,pPOK)   <-----------
  IV = 0
  NV = 0
  PV = 0x81836f0 "5"\0   <-----------
  CUR = 1
  LEN = 4
  MAGIC = 0x8188880
    MG_VIRTUAL = &PL_vtbl_sv
    MG_TYPE = PERL_MAGIC_sv(\0)
    MG_OBJ = 0x817c550
    MG_LEN = 1
    MG_PTR = 0x81888a0 "1"

Without "use 5.12.0;"
$ perl a.pl
SV = PVMG(0x81768b0) at 0x818d648
  REFCNT = 1
  FLAGS = (GMG,SMG)   <-----------
  IV = 0
  NV = 0
  PV = 0
  MAGIC = 0x8187250
    MG_VIRTUAL = &PL_vtbl_sv
    MG_TYPE = PERL_MAGIC_sv(\0)
    MG_OBJ = 0x818d638
    MG_LEN = 1
    MG_PTR = 0x8187100 "1"
SV = PVMG(0x81768b0) at 0x818d648
  REFCNT = 1
  FLAGS = (GMG,SMG)   <-----------
  IV = 0
  NV = 0
  PV = 0
  MAGIC = 0x8187250
    MG_VIRTUAL = &PL_vtbl_sv
    MG_TYPE = PERL_MAGIC_sv(\0)
    MG_OBJ = 0x818d638
    MG_LEN = 1
    MG_PTR = 0x8187100 "1"
Can't kill a non-numeric process ID at a.pl line 7.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.