Exec will shell out and run whatever exec called. At least I believe the correct term is "shell out". Learning Perl says in page 196 that exec locates the program you called and jumps to it. There is no perl process anymore. So I guess it's more of an exit Perl and run this command sort of thing.. So once you do that, Perl is gone. System however returns you back to Perl. If you want Perl not to wait you can open a process as a file handle. I haven't tried it however it suggests this will run Perl and your process in parallel.

Something to try



[EMAIL PROTECTED] wrote:

from what I remember reading and was told as a best practice using exec /.../..../ was recommended over system. For this reason exec does not create a child and therefore does not have to wait. the perl process itself runs the command or program. what are the pros and cons of each?

thanks


Derek B. Smith OhioHealth IT UNIX / TSM / EDM Teams






u235sentinel <[EMAIL PROTECTED]> 06/25/2004 11:58 AM


To: cc: [EMAIL PROTECTED]
Subject: Re: 'system' and parallel execution (was: Re: How to call a perl script....)





Wiggins d Anconia wrote:



Not exactly, it has been forked and does technically run in parallel,
however 'system' blocks your current process waiting for the child to
finish, so your process is in fact running, but it won't be doing any
work except for waiting for a signal from the child.

There are other ways to have parallel execution,

perldoc perlipc
perldoc -f fork
perldoc -f system



Ok. I'll read those in a minute. After reviewing Learning Perl, I realize I need to open the process as a file handle for parallel operations. Called a "piped open". (page 201 Oreilly Learning Perl).



Will get you started. "Network Programming with Perl" by Lincoln Stein
also has excellent chapters on this subject, though lacks a chapter
(probably because of its age) on POE.




Haven't purchased that book yet (it's on my amazon wish list however). I'll check it out.

Thanks!





Reply via email to