Re: Proc::Simple - Poll
- From: "Sisyphus" <sisyphus1@xxxxxxxxxxxxxxxxx>
- Date: Thu, 19 Jan 2006 13:36:05 +1100
<jdenevan@xxxxxxxxxxx> wrote in message
news:1137621165.154841.50490@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hello,
> I have a perl script that runs continuously and launches other Perl
> scripts. I'm using Proc::Simple to do this.
..
..
>
> I'm using ActivePerl on a WinXP Pro box.
Proc::Simple doesn't work properly on Win32. Most of the tests fail.
You would be better off using Win32::Process - which you'll already have
since you're using AS perl. Here's a tested example (that won't necessarily
do *exactly* what you want):
use warnings;
use strict;
use Win32::Process;
my $timeout = 1000; # milliseconds
my $ProcessObj;
my $exe = "D:\\perl\\bin\\perl.exe"; # modify as needed
my $cmdline = "perl myScript.pl";
my $priority = NORMAL_PRIORITY_CLASS;
my $console_flag = CREATE_NEW_CONSOLE; # eg
Win32::Process::Create(
$ProcessObj,
$exe,
$cmdline,
0,
$priority | $console_flag,
"."
)|| die $^E;
# Wait() returns '1' if the process finished
# during the timeout period. Else returns 0.
while(!($ProcessObj->Wait($timeout))) {
print "It's still running\n";
}
print "myScript.pl has finished\n";
__END__
'perldoc Win32::Process' is not as helpful as it might be (but check it out,
anyway). There's good documentation of his module in Chapter 8 of Dave
Roth's "Win32 Perl Programming: The Standard Extensions" (if you have access
to that book).
Cheers,
Rob
.
- Follow-Ups:
- Re: Proc::Simple - Poll
- From: jdenevan
- Re: Proc::Simple - Poll
- References:
- Proc::Simple - Poll
- From: jdenevan
- Proc::Simple - Poll
- Prev by Date: Proc::Simple - Poll
- Next by Date: Net::Daemon::SSL
- Previous by thread: Proc::Simple - Poll
- Next by thread: Re: Proc::Simple - Poll
- Index(es):
Relevant Pages
|
|