diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Win32/Process/Info/PT.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/Win32/Process/Info/PT.pm | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/Master/tlpkg/tlperl/lib/Win32/Process/Info/PT.pm b/Master/tlpkg/tlperl/lib/Win32/Process/Info/PT.pm index 67bf7562cc9..17a9643dc05 100644 --- a/Master/tlpkg/tlperl/lib/Win32/Process/Info/PT.pm +++ b/Master/tlpkg/tlperl/lib/Win32/Process/Info/PT.pm @@ -28,11 +28,15 @@ only be called via that package. =head1 DESCRIPTION -The main purpose of the Win32::Process::Info package is to get whatever -information is convenient (for the author!) about one or more +The main purpose of the Win32::Process::Info::PT package is to get +whatever information is convenient (for the author!) about one or more processes. GetProcInfo (which see) is therefore the most-important method in the package. See it for more information. +This package returns whatever process IDs are made available by +Proc::ProcessTable. Under Cygwin, this seems to mean Cygwin process IDs, +not Windows process IDs. + Unless explicitly stated otherwise, modules, variables, and so on are considered private. That is, the author reserves the right to make arbitrary changes in the way they work, without telling @@ -63,8 +67,9 @@ package Win32::Process::Info::PT; use strict; use warnings; -use base qw{Win32::Process::Info}; -our $VERSION = '1.019'; +use base qw{ Win32::Process::Info }; + +our $VERSION = '1.020'; use Carp; use File::Basename; @@ -190,10 +195,15 @@ to be consistent with the other variants. sub GetProcInfo { my ($self, @args) = @_; + + my $my_pid = $self->My_Pid(); my $opt = ref $args[0] eq 'HASH' ? shift @args : {}; my $tbl = Proc::ProcessTable->new ()->table (); + if (@args) { - my %filter = map {(($_ eq '.' ? $$ : $_), 1)} @args; + my %filter = map { + ($_ eq '.' ? $my_pid : $_) => 1 + } @args; $tbl = [grep {$filter{$_->pid ()}} @$tbl]; } my @pinf; @@ -229,10 +239,15 @@ reference to the list is returned. sub ListPids { my ($self, @args) = @_; + my $tbl = Proc::ProcessTable->new ()->table (); + my $my_pid = $self->My_Pid(); my @pids; + if (@args) { - my %filter = map {(($_ eq '.' ? $$ : $_), 1)} @args; + my %filter = map { + ($_ eq '.' ? $my_pid : $_) => 1 + } @args; @pids = grep {$filter{$_}} map {$_->pid} @$tbl; } else { @pids = map {$_->pid} @$tbl; @@ -240,6 +255,10 @@ sub ListPids { return wantarray ? @pids : \@pids; } +sub My_Pid { + return $$; +} + =back =head1 REQUIREMENTS @@ -270,7 +289,7 @@ Thomas R. Wyant, III (F<wyant at cpan dot org>) =head1 COPYRIGHT AND LICENSE -Copyright (C) 2007, 2009-2011 by Thomas R. Wyant, III +Copyright (C) 2007, 2009-2011, 2013 by Thomas R. Wyant, III This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text |