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

[email protected] (Todd Rinaldo)
Newsgroups perl.perl5.porters
Message-ID <[email protected]>
> $1 is magic, so until SvGETMAGIC() is called it has no flags.
> 
> Patch calls SvGETMAGIC() before checking the flags, and uses the no
> magic variant of SvIV() avoid to double magic.
> 
> looks_like_number() can also call SvGETMAGIC() via SvPV_const(), but
> that's a different problem.
> 
> Tony
> From 322ed3e750982361473addd7d45edcbace447752 Mon Sep 17 00:00:00 2001
> From: Tony Cook <[email protected]>
> Date: Thu, 17 Jun 2010 18:58:04 +1000
> Subject: [PATCH] RT #75812: apply get magic before checking flags, PVX
> 
> The code was checking flags with applying any get magic, so when a
> match was doing putting a numeric string into $1, none of the flags
> checked were set, so producing the "non-numeric process ID" error.

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;
}
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.