This works perfectly on my system (XP Pro SP2, 5.8.6) - starts and kills
the ping process. The sleeps are so you can watch with task
manager/pslist. Can you confirm whether it works on yours?

Paul


use Win32::Process;

my $ProcessObj;
Win32::Process::Create($ProcessObj,
   "$ENV{SYSTEMROOT}\\System32\\ping.exe",
   "ping -t 127.0.0.1",
   0,
   NORMAL_PRIORITY_CLASS,
   ".") || die;
                
my $pid = $ProcessObj->GetProcessID();

print "Got pid $pid\n";
sleep 5;
$ProcessObj->Kill(0);
print "Process killed\n";
sleep 5;

 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: 25 February 2005 08:43
To: perl-win32-users@listserv.ActiveState.com
Subject: Win32::Process->kill() macro not defined

I'm trying to use Win32::Process to run an external program
asynchronously while I run a countdown timer in the main program. If the
timer runs out, I want to kill the other program/process. I am able to
create the second process fine, my program continues to the timer, but
when the timer expires and the program tries to execute:
    $ChilcProcObj->Kill(0);   # or 1 or -1 
I get a message:  Your vendor has not defined Win32::Process macro kill,
used at TestFork3.pl line 51. at C:/Perl/site/lib/Win32/Process.pm line
47. I don't know anything about the internals of this module -- was
something not compiled in?

This happens regardless of whether the second process is still running
when the timer expires, or if it ended on its own earlier.

I found a posting in another forum where someone ran into the same
problem, but got no helpful responses. I'm using perl v5.8.3 built for
MSWin32-x86-multi-thread.

Is this a problem fixed in a later version perhaps? I was going to try a
later version, but the ActiveState download site wasn't working. (It
returns "Script failed to send data.")

Thanks,
Garyl Erickson



_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


*****************************************************************
Gloucester Research Limited believes the information 
provided herein is reliable. While every care has been 
taken to ensure accuracy, the information is furnished 
to the recipients with no warranty as to the completeness 
and accuracy of its contents and on condition that any 
errors or omissions shall not be made the basis for any 
claim, demand or cause for action.
*****************************************************************


_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to