The "Right Way" (TM) to run external program out of gtk2-perl app?



Hi everybody,

topics related to sql-requests and so on have been discussed on this list, but 
I still don't get the "big picture" to select the right solution for my 
needs:

My gtk2-perl application offers some image conversions using "convert" from 
the ImageMagick-tools. As of now, I simply call "convert" with a system() 
statement. If convert-ing more than one image, I update a ProgressBar 
("processing x of y...") in between the separate system() calls.
Now muppets statement in
http://mail.gnome.org/archives/gtk-perl-list/2005-August/msg00166.html makes 
me thinking again about my approach:
The call to system() blocks, so the main loop cannot run, and therefore the
gui does not update or respond to input. Don't do that.

If converting too many images in a sequence, I sometimes get a sudden system 
reboot (!) that I, up to now, explained with some hardware issue. Could this 
be related to my way of calling convert, blocking the UI again and again?

What is the most safe and clean way of calling convert?
My requirements are
1) portability (Linux + Win32)
2) check exit status of convert
3) no need to write to or read from convert (no pipe needed)
4) UI blocking not nice, but would be acceptable
5) only one instance of convert at a time
6) the subroutine calling convert must not return until convert is done, 
because I need to do some updates (ProgressBar, image display, ...) 
afterwords, and to hold for 5.

I tried the solution for long-file-reading in the FAQ with Helper::add_watch, 
but it doesn't hold for 6). Didn't try it on win32.

Hopefully I could make my point clear enough... Thank you very much for your 
hints!

Stephan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]