List Info

Thread: Running another exe program from Main Perl program without interupting




Running another exe program from Main Perl program without interupting
country flaguser name
United States
2008-03-16 11:29:16

Friends,

I would like to run another (.exe) program from my perl main program
without any interrupting my main program.

Right now I am using

system("newprogram.exe");

But for this my main program is waiting for the new program to get
closed. I still want my main program to continue while the
"newprogram.exe"; is running.

Thanks

Joshy

__._,_.___
.

__,_._,___
Re: Running another exe program from Main Perl program without interupting
country flaguser name
United States
2008-03-16 15:39:31

--- In perl-beginner%40yahoogroups.com">perl-beginneryahoogroups.com, "joshypy" <joshypy...> wrote:
&gt; I would like to run another (.exe) program from my perl main program
> without any interrupting my main program.
>
> Right now I am using
>
> system(&quot;newprogram.exe&quot;);
>
> But for this my main program is waiting for the new program to get
> closed. I still want my main program to continue while the
> "newprogram.exe" is running.

In other words, you want to fork off a child process.

perldoc -f fork
perldoc perlfork

/sandy
http://myperlquiz.com/

__._,_.___
.

__,_._,___
Re: Running another exe program from Main Perl program without interupting
country flaguser name
Czech Republic
2008-03-17 09:39:12

From: "joshypy" < joshypy%40yahoo.co.in">joshypyyahoo.co.in>
&gt; I would like to run another (.exe) program from my perl main program
> without any interrupting my main program.
>
> Right now I am using
>
> system(&quot;newprogram.exe&quot;);
>
> But for this my main program is waiting for the new program to get
> closed. I still want my main program to continue while the
> "newprogram.exe" is running.

system( 1, "newprogram.exe");

>From
perldoc perlport

As an optimization, may not call the command shell specified in
$ENV{PERL5SHELL}. system(1, args) spawns an external process and
immediately returns its process designator, without waiting for it to
terminate. Return value may be used subsequently in wait or waitpid.
Failure to spawn() a subprocess is indicated by setting $? to "255 <<
8". $? is set in a way compatible with Unix (i.e. the exitstatus of
the subprocess is obtained by "$? >> 8", as described in the
documentation). (Win32)

If you need more control have a look at Win32::Process.

HTH, Jenda
===== Jenda%40Krynicky.cz">JendaKrynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

__._,_.___
.

__,_._,___
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )