i want to kill spawned process and its child if image*.tiff exists or timeout.
c:\\test\\a.pl is to generate the tiff by print the acrobat reader to default
printer which creates the tif file.
i have tried the following without success.
use Win32::Job;
my $job = Win32::Job->new;
# Run for 10 seconds
print "start ......";
#$job->spawn($Config{perlpath}, "perl");
$job->spawn($Config{perlpath}, "perl c:\\test\\a.pl");
#$job->run(10);
$ok = $job->watch( sub {
return 1 if ((glob "image*.tiff") || sleep (30));
}
, 1);
If image*.tiff is changed to an file already existed, the spawn process is
terminated very quickly. It could not detect image*.tiff if it is generated by
a.pl (by printer driver). it times out after 30 secs.
I am a newbie to perl. pls kindly advise. if you know win32::process, pls
advise code, too.
--- 2009年8月8日 星期六,Michael Zeng <[email protected]> 寫道﹕
寄件人: Michael Zeng <[email protected]>
主題: Re: check wildcards within a sub
收件人: "Aclhk Aclhk" <[email protected]>
日期: 2009年8月8日,星期六,下午12:50
if ( glob "image*.tiff" ) {
.....
}
On Sat, Aug 8, 2009 at 12:54 PM, Aclhk Aclhk <[email protected]> wrote:
I need to check image*.tiff if exists (just any one match is ok) within the
following code. pls advise using glob or anything.
use Win32::Job;
my $job = Win32::Job->new;
$job->spawn($Config{perlpath}, "perl c:\\test\\a.pl");
$ok = $job->watch( sub {
return 1 if (-e "image*.tiff") || sleep (30);
}
, 1);
Yahoo!香港提供網上安全攻略,教你如何防範黑客!了解更多
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--
Yours Sincerely
Zeng Hong
Yahoo!香港提供網上安全攻略,教你如何防範黑客! 請前往 http://hk.promo.yahoo.com/security/ 了解更多!_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs