rovf has asked for the wisdom of the Perl Monks concerning the following question:

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>

Replies are listed 'Best First'.
Re: Win32::Process::Info question
by BrowserUk (Patriarch) on Sep 14, 2011 at 11:49 UTC
    but why, on earth, would a module to fetch process information, need RPC?

    Because that is how WMI is implemented. The WMI database is mainatained and administered by the WMI service, and requests to that service are implemented using RPC calls to it. If the service isn't running, the RPCs will fail.

    For the NT method, Win32::Process::Info use Win32::API to access system APIs, but in recent years Win32::API has been messed around with so much that it no longer functions properly.

    What version of perl is running on the failing system?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      in recent years Win32::API has been messed around with so much that it no longer functions properly.
      This is indeed interesting (well, what else can we expect from Micro$oft?). However in my case, it works on the new system (Win 7) and fails on the old one (Win XP).
      What version of perl is running on the failing system?
      In both cases (unfortunately still) 5.8.8.

      -- 
      Ronald Fischer <ynnor@mm.st>
        (well, what else can we expect from Micro$oft?)

        Oh dear. How ruled by petty prejudices people are.

        It's the Win32::API module that has been messed around with, and that has zip, zero, nada, nothing to do with Microsoft. They didn't write it, and they aren't the ones messing with it.

        What version of perl is running on the failing system? In both cases (unfortunately still) 5.8.8.

        32-bit or 64-bit? On a 32-bit or 64-bit version of which flavour of windows? Etc. You've been around long enough to know better how to answer that question.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Win32::Process::Info question
by Corion (Patriarch) on Sep 14, 2011 at 11:40 UTC
    Can't locate loadable object for module Win32::API

    This means that however you installed Win32::API, it was broken and is missing (parts of) API.dll. First debug that error, then look further.

      You were right, as usual!!! Indeed, API.dll happened to not have been copied to the other host. Thanks a lot!

      -- 
      Ronald Fischer <ynnor@mm.st>