in reply to Re: Kill a perl script execution in windows
in thread Kill a perl script execution in windows

That's good for preventing a second copy from starting; but not so useful for killing the previous version if it is running because it doesn't give you the pid.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
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.
  • Comment on Re^2: Kill a perl script execution in windows

Replies are listed 'Best First'.
Re^3: Kill a perl script execution in windows
by nikosv (Deacon) on Feb 18, 2013 at 16:06 UTC
    you don't need the PID. The first script waits for a signal to terminate as:
    use Win32::Event; use 5.010; $event = Win32::Event->new(1,0,"myevent"); while ($event->wait(0)==0) { say $i; print $i++; } say "exiting";
    or just $event->wait(), depends on the situation.Then the second one can signal it to abort :
    use Win32::Event; use 5.010; $event = Win32::Event->new(1,0,"myevent"); say $^E; $event->set;