From: Mattia B. <mat...@li...> - 2007-03-17 19:57:18
|
On Fri, 16 Mar 2007 13:50:49 +0900 Evan Read <er...@ii...> wrote: Hi, > I am currently writing my first wxperl program. What I am doing is > taking a user selection of a source dir and a destination dir and am > taring up the source dir to the destination dir. I haven't looked at the code yet, but I suggest you take a look at Wx::Execute and Wx::Process ("::wxExecute" and "wxProcess" in the wxWidgets documentation). They allow to (a)synchronously execute subprocesses with input/output redirection, to portably send signals and terminate processes and offer termination notification callbacks. Regards Mattia # execute asyncronously my $proc = MyProcess->new; my $pid = Wx::ExecuteArgs( [$progname, @args], 0, $proc ); # use $proc to control the program # OnTerminate will be called when the process finishes package MyProcess; use strict; use base qw(Wx::Process); sub new { my $class = shift; my $this = $class->SUPER::new(); return $this; } sub OnTerminate { my( $this, $pid, $status ) = @_; Wx::LogMessage( "Process '$pid' terminated with status $status" ); } 1; |