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

[perl #24353] kill() --- POD needs a hand

From:
James E Keenan via RT
Date:
December 4, 2011 18:08
Subject:
[perl #24353] kill() --- POD needs a hand
Message ID:
rt-3.6.HEAD-5084-1323050881-26.24353-15-0@perl.org
On Wed Oct 29 03:05:10 2003, Michael.Jacob@SCHERING.DE wrote:

> $ perl -e 'print kill 0, undef, undef'
> 2
> 
> I'd think the semantics of a PID=0 should be documented in
> perlfunc. 

When I run your example today, I get:

#####
$ perl -e 'print kill 0, undef, undef'
Can't kill a non-numeric process ID at -e line 1.
#####

... which is entirely plausible to me in light of the current
documentation for 'perldoc -f kill':

#####
kill SIGNAL, LIST
Sends a signal to a list of processes.  Returns the number of
processes successfully signaled (which is not necessarily the
same as the number actually killed).
...
If SIGNAL is zero, no signal is sent to the process, but "kill"
checks whether it's possible to send a signal to it (that
means, to be brief, that the process is owned by the same user,
or we are the super-user). 
#####

And this is the behavior I get if, for example, I set off two pings and
then attempt to 'kill 0' them.

#####
$ ps u | grep ping | grep -v grep
jimk  9676   0.0  0.1    27456    380  p2  S+    8:57PM   0:00.23 ping
thenceforward.net
jimk  9681   0.0  0.1    27456    380  p4  S+    8:57PM   0:00.27 ping
www.google.com

$ perl -e 'print kill 0, 9676, 9681'

$ ps u | grep ping | grep -v grep'
jimk  9676   0.0  0.1    27456    380  p2  S+    8:57PM   0:00.24 ping
thenceforward.net
jimk  9681   0.0  0.1    27456    380  p4  S+    8:57PM   0:00.27 ping
www.google.com
#####

Since the behavior is consistent with the (current) documentation, I
don't think there is a bug here.

Thank you very much.
Jim Keenan



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About