ok then I think system is more ideal for most situations.
thanks,
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
"Wiggins d Anconia" <[EMAIL PROTECTED]>
06/25/2004 12:40 PM
To: u235sentinel <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
cc:
Subject: Re: 'system' and parallel execution (was: Re: How to call a
perl
script....)
>
> 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..
Correct.
perldoc -f exec
For more.
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.
Yes, alternatively you can use fork+exec to have a forked process that
is non-blocking, the reason to use pipes is so that the two can
communicate more easily, this isn't always desired.
>
> Something to try
>
perldoc perlipc
perldoc perlfork
perldoc IPC::Open3
Explains most of this, much better than I can.
http://danconia.org
>
>
> [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!
> >
> >
> >
> >
> >
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>