CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
about exec command



Nov 3, 2004, 1:24 PM

Post #1 of 3 (1337 views)
about exec command Can't Post

Hello all,

I am writing a perl script which is always running and keep check for new arrived files. One new files arrives, it will first uninstall the previous version and then start install the new version.
$newVersion = check if new version arrives();



I am using exec to execute the uninstall and install, but after the unInstall finishes, the perl script exit from the while loop, which is not what I want. If I use System instead of exec command, how can I ensure the install starts after the completion of uninstall?

Thanks for any advices.


Nov 3, 2004, 2:58 PM

Post #2 of 3 (1336 views)
Re: [babyBlue] about exec command [In reply to] Can't Post

you probably want to use system instead of exec. See perldoc:

list of Perl functions:

system function:

(This post was edited by KevinR on Nov 3, 2004, 2:59 PM)

Thaumaturge / Moderator

Nov 4, 2004, 5:21 AM

Post #3 of 3 (1329 views)
Re: [babyBlue] about exec command [In reply to] Can't Post

As KevinR says, you certainly want "system" and not "exec". "exec" will replace the current process (i.e. your program) with the new program. Which is what you are seeing and not what you want.

And as "system" doesn't return until the command has completed, there won't be a problem with your installation starting before uninstallation has finished.

I'd recommend reading the documentation of the functions that you want to use.

Dave Cross, Perl Hacker, Trainer and Writer
Get more help at Perl Monks


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives