Using ActiveState Perl 5.8.8, this seems to work on both of my platforms:
use Win32::Process::Info; my $wpi=Win32::Process::Info->new();
But since the docs explain:
if you use fork(), you must disallow WMI completely by loading this module as follows: use Win32::Process::Info qw{NT};
I decided to write the code like this:
use Win32::Process::Info qw(NT); my $wpi=Win32::Process::Info->new;
This works fine on one of my systems, but on the other one it complains:
Error - Variant 'WMI' is unsupported on your configuration. Disallowed + on load of Win32::Process::Info. at ... Error - Variant 'NT' is unsupported on your configuration. Can't locat +e loadable object for module Win32::API in @INC Compilation failed in + require at ... Error - Variant 'PT' is unsupported on your configuration. Disallowed +on load of Win32::Process::Info. at ...
Same result if I replace the constructor call by Win32::Process::Info->new('NT'). The working system runs Windows 7, while the one showing the error runs Windows XP. Of course there might be other differences in the setup of the two hosts which could matter in this case.

I tried to get more information by playing around a bit with the code:

use Win32::Process::Info; my $wpi=Win32::Process::Info->new('NT');
This resulted in the following error messages:
Error - Win32::Process::Info::WMI failed to get winmgs object: Win32::OLE(0.1707) error 0x800706ba: "The RPC server is unavailable" a +fter character 0 in "winmgmts:{impersonationLevel=impersonate}!//NT/root/cimv2" at ... Error - Variant 'NT' is unsupported on your configuration. Can't locat +e loadable object for module Win32::API in @INC ... Error - Variant 'PT' is unsupported on your configuration. Unable to l +oad Proc::ProcessTable at ...
I don't know enough about Windows to understand the Windows message, but at least it explains the message about 'PT' variant. This module isn't installed (which is surprising - I had installed everything using ppm and would have expected that these dependencies would be resolved implicitly). Anyway, I'm more interested in the 'NT' variant, so I wonder what this Windows error message is supposed to mean. It claims about a missing RPC server. I guess this RPC means "remote procedure call". While I don't administer the host in question, it might well be that there is no RPC server defined; but why, on earth, would a module to fetch process information, need RPC?

Another interesting question is the meaning of the error message about the NT variant. It complains about a missing "loadable object". What's this? And why is it that this error doesn't show up when I leave out the specification of an explicit variant in the import list of the module and in the parameter to the new() function?

-- 
Ronald Fischer <ynnor@mm.st>

In reply to Win32::Process::Info question by rovf

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.