There is some interest over on the ActiveState mailing lists for a module
to return information on an arbitrary Windows 32 process. The proposed
module does this, returning all available information on a given process in
a hash.

There is overlap with three known modules: Win32::IProc, Win32::PerfLib,
and Win32::AdminMisc. Win32::IProc is aparantly abandoned. Win32::PerfLib
is maintained, and is the only listed module which I can find on CPAN, but
is oriented toward performance statictics. There was correspondence on the
ActiveState mailing list about merging with Win32::AdminMisc, but I
understood the consensus there to be a separate module, though there was a
strong minority opinion that there should be no module at all, and people
should just learn to use WMI directly through the OLE interface.

The goal of this module is to provide all the information I could find
about a process, under all Windows variants I had access to. To achieve
this goal it has submodules which it invokes depending on the operating
environment in which it finds itself. There are currently two such: WMI
(which uses the Windows Management Interface) and NT (which uses
"NT-native" calls, and does not require WMI to be installed - which means
it works on non-retrofitted versions of NT 4.0). It will make use of WMI if
present, but does not require it, which is why I did not propose a name
like Win32::OLE::WMI::ProcInfo.

The interface is pretty simple:

use Data::Dumper;
use Win32::ProcInfo;
$pi = ProcInfo->new ([machine], [variant]);
print "Known PIDs: @{[$pi->ListPids ()]}\n";
print "Known info: ", Dumper ($pi->GetProcInfo ());

The WMI variant will request information on another machine; the NT variant
won't, and throws an exception if you try. The 'variant' argument allows
you to specify which variant is instantiated (or which ones are to be
tried, in which order) and is used mainly for testing.

ListPids and GetProcInfo both take an optional list of process IDs as
arguments, and return only such of those processes as actually exist.

I do not yet have a personal namespace registered on CPAN - I thought I'd
see how this trial balloon went first.

Thanks,
Tom Wyant

Reply via email to