develooper Front page | perl.perl5.porters | Postings from June 2010

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

Thread Previous | Thread Next
From:
Todd Rinaldo
Date:
June 17, 2010 13:35
Subject:
Re: [perl #75812] kill $1 broken in 5.12.1
Message ID:
9E9A432B-4EE3-4F5C-9567-80B49D1531F8@cpanel.net
> $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 <tony@develop-help.com>
> 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;
}


Thread Previous | 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