Hello Kevin,
Sunday, March 17, 2002, 6:42:11 AM, you wrote:
K> Seeing that alarm has not been implemented on Win32, as per the
K> docs, is there another alternative to actual kill of a perl script
K> is it decides to sit around for a very long time... apart from
K> making sure the the script itself is working properly?
It isn't exactly elegant but I had to do this recently with a program
that made a database connection and I didn't want it waiting forever.
You could use a similar technique I think.
----------------------------------------------
use Win32::Process;
use Win32;
my $wait = 3 * 60 * 1000; # milliseconds
Win32::Process::Create(my $ProcessObj,
"C:/Perl/bin/perl.exe",
"perl C:/Projects/Perl/myprogram.pl",
0,
NORMAL_PRIORITY_CLASS,
".")|| die EndWithError();
my $ProcessID = $ProcessObj->GetProcessID();
$ProcessObj->Wait($wait); # milliseconds
$ProcessObj->GetExitCode( my $exitcode );
if ($exitcode == 1422) {
# do nothing - just end
} else {
# kill
$ProcessObj->Kill(1);
# do some other stuff
}
----------------------------------------------
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs