http://qs1969.pair.com?node_id=603005

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

Hello all,

I sure I must have missed something here, the penny just hasn't yet dropped and thus request the help of the wise. You see i'm trying to write some code to kill processes on a Win32 machine. I've started to bend my head around the documentation at hand (Win32::Process).

Win32::Process::KillProcess($pid, $exitcode) Terminates any process identified by $pid. $exitcode will be set to the exit code of the process.

Now I have had success with this yes, i can kill processes ok and i can visually see that, but my program doesn't know that because it doesn't know what the return value means (neither do I).

If i do :

my rval=Win32::Process::KillProcess($pid,$exitcode);

$rval seems to equal '1' upon success or an arbitrarily large number on failure. I've got this all wrong haven't I. Can you help ? I'd have assumed the call would return the PID on success or undef on failure, no ?

many thanks for your time,

Isaac Close.