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

I apologize if this has been dealt with before, but alas Super Search has let me down. I am attempting to use Win32::Api, but am having issues. I installed the package I believe correctly (I have the api.pm in the @INC path). This is my code:
use Win32::API; $GetPID = new Win32::API("kernel32", "GetCurrentProcessId", [], N); $PID = $GetPID->Call();
I run this with -w and the result I get is:
Can't locate loadable object for module Win32::API in @INC (@INC conta +ins: C:/Perl/lib C:/Perl/site/lib .) at comm.pl line 2 Compilation failed in require at comm.pl line 2. BEGIN failed--compilation aborted at comm.pl line 2.
Any help would be greatly appreciated.

Replies are listed 'Best First'.
Re: Package install
by insensate (Hermit) on Oct 07, 2002 at 22:46 UTC
    I have the api.pm in the @INC path

    Did you actually install the module with ppm or the like...or did you just copy API.pm into a lib directory? When installed correctly the module will end up in lib\Win32\API.pm.
    Jason
      Yeah - Make sure you use ppm (go: Start -> Run... -> "ppm"; then type: "install win32-api") or something similar to install win32::api.

      --nutshell

Re: Package install
by semio (Friar) on Oct 08, 2002 at 02:40 UTC
    Hi Anonymous Monk

    This message probably indicates that the dll for this module can't be found. Did you make the package? If so, you should have seen the following during the install:

    C:\win32api\Win32-API-0.20>nmake install Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved. Installing C:\Perl\site\lib\auto\Win32\API\API.dll Installing C:\Perl\site\lib\auto\Win32\API\API.lib Installing C:\Perl\site\lib\auto\Win32\API\API.exp Installing C:\Perl\site\lib\auto\Win32\API\API.bs Installing C:\Perl\site\lib\Win32\API.pm Writing C:\Perl\site\lib\auto\Win32\API\.packlist Appending installation info to C:\Perl\lib/perllocal.pod
    I would start with this. Hope this helps.

    cheers, -semio

Re: Package install
by kabel (Chaplain) on Oct 07, 2002 at 22:24 UTC
    for this specific call: the variable $$ holds the PID you want to retrieve :p

    sorry i cannot help you with your real problem - your code works for me.
Re: Package install
by helgi (Hermit) on Oct 08, 2002 at 10:14 UTC
    Win32::API comes loaded with Activeperl by default, so you shouldn't really have to install it.

    Your code works fine for me.

    My wild, stab in the dark guess, based on prior experience, is that you upgraded your Activeperl setup, but didn't bother uninstalling the old one first. This seems to lead to modules being invisible. The solution is to uninstall all the old versions and then install a new one.

    --
    Regards,
    Helgi Briem
    helgi AT decode DOT is