diff options
| author | Andreas Brachold <vdr07@deltab.de> | 2007-11-11 18:36:47 +0000 |
|---|---|---|
| committer | Andreas Brachold <vdr07@deltab.de> | 2007-11-11 18:36:47 +0000 |
| commit | a90c07847c7d4744e609a36abb55a6eb55e6d1ed (patch) | |
| tree | aaaab8f737617bca7ed48cca06bd58bc2614a530 /lib | |
| parent | a14dbc0eab1f9bb066553d30e0ef368287300fde (diff) | |
| download | xxv-a90c07847c7d4744e609a36abb55a6eb55e6d1ed.tar.gz xxv-a90c07847c7d4744e609a36abb55a6eb55e6d1ed.tar.bz2 | |
* Remove PROC::Killfam
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Bundle/Xxv.pm | 1 | ||||
| -rw-r--r-- | lib/Proc/Killfam.pm | 83 |
2 files changed, 1 insertions, 83 deletions
diff --git a/lib/Bundle/Xxv.pm b/lib/Bundle/Xxv.pm index 5de7c1a..d5191e1 100644 --- a/lib/Bundle/Xxv.pm +++ b/lib/Bundle/Xxv.pm @@ -44,6 +44,7 @@ Net::Amazon Net::Amazon::Request::Artist Net::Telnet Net::XMPP +Proc::Killfam Proc::ProcessTable SOAP::Lite SOAP::Transport::HTTP diff --git a/lib/Proc/Killfam.pm b/lib/Proc/Killfam.pm deleted file mode 100644 index 6f785cb..0000000 --- a/lib/Proc/Killfam.pm +++ /dev/null @@ -1,83 +0,0 @@ -$Proc::Killfam::VERSION = '1.0'; - -package Proc::Killfam; - -use Exporter; -use base qw/Exporter/; -use subs qw/get_pids/; -use vars qw/@EXPORT @EXPORT_OK $ppt_OK/; -use strict; - -@EXPORT = qw/killfam/; -@EXPORT_OK = qw/killfam/; - -BEGIN { - $ppt_OK = 1; - eval "require Proc::ProcessTable"; - if ($@) { - $ppt_OK = 0; - warn "Proc::ProcessTable missing, can't kill sub-children."; - } -} - -sub killfam { - - my($signal, @pids) = @_; - - if ($ppt_OK) { - my $pt = Proc::ProcessTable->new; - my(@procs) = @{$pt->table}; - my(@kids) = get_pids \@procs, @pids; - @pids = (@pids, @kids); - } - - kill $signal, @pids; - -} # end killfam - -sub get_pids { - - my($procs, @kids) = @_; - - my @pids; - foreach my $kid (@kids) { - foreach my $proc (@$procs) { - if ($proc->ppid == $kid) { - my $pid = $proc->pid; - push @pids, $pid, get_pids $procs, $pid; - } - } - } - @pids; - -} # end get_pids - -1; - -__END__ - -=head1 NAME - -Proc::Killfam - kill a list of pids, and all their sub-children - -=head1 SYNOPSIS - - use Proc::Killfam; - killfam $signal, @pids; - -=head1 DESCRIPTION - -B<killfam> accepts the same arguments as the Perl builtin B<kill> command, -but, additionally, recursively searches the process table for children and -kills them as well. - -=head1 EXAMPLE - -B<killfam 'TERM', ($pid1, $pid2, @more_pids)>; - -=head1 KEYWORDS - -kill, signal - -=cut - |
