------------------------------------------------
On Mon, 10 Feb 2003 14:48:34 -0600, "Aman Raheja" <[EMAIL PROTECTED]> wrote:

> Hi friends 
> I am doing exec in a foreach loop, resizing images.
> But as the the exec is kicked off, it never returns....
> What's the way out?
> Here's the snippet
> -------------------------------------------------------------------
> foreach(@$ref)    {
> 
>     $imgFile = @$_->[1].jpg;
>     $thbFile = @$_->[1]-t.jpg;
>     $convertedSize = @$_->[3]."x".@$_->[4];
> 
>     exec("convert $imgFile -resize $convertedSize $thbFile");
> 
> }
> ----------------------------------------------------------------------
> 
> The loop executes only once, as the exec forks out and waits infinitely


You are mis-using exec.  If you need it to return you should fork before the exec, and 
then wait (or waitpid).  For your purposes you should be able to use 'system', unless 
you want parallel processing in which case you should fork/exec.

perldoc -f system
perldoc -f fork
perldoc -f exec
perldoc -f wait
perldoc -f waitpid
perldoc perlipc

exec is specifically designed to take over the process and never return.

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to