Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Opening files for other exes in Windows

by Roger (Parson)
on Aug 22, 2006 at 05:59 UTC ( #568776=note: print w/replies, xml ) Need Help??


in reply to Opening files for other exes in Windows

To start with, perl exec is not going to return control to the calling program.

perldoc -f exec exec LIST exec PROGRAM LIST The "exec" function executes a system command and never returns-- use "system" instead of "exec" if you want it to return. It fails and returns false only if the command does not exist and it is executed directly instead of via your system's command shell (see below).

To spawn another process is quite easy in Perl. The following code will do what you want:
... my $pid = fork(); if (undefined $pid) { die 'Fork failed'; } if (!$pid) { # I am in the child process system $MYCOMMAND; exit; } # I am in the parent process # continue with other business ...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://568776]
help
Chatterbox?
[marto]: it makes things less stressful for the parents that's for sure :P
[Corion]: Yeah (although their mother was somewhat stressed out regardless) - but it made for an otherwise relaxed evening ;)

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2016-12-08 09:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (139 votes). Check out past polls.