Hi Chuck,


Chuck wrote:
We have a GUI where, if a button is clicked, Putty (the remote access
program) is launched using

System("C:\\Progra~1\\Putty\\putty.exe");

is launched. However, when this is executed, the original GUI freezes,
and we cannot use it unless we close Putty. We tried using the fork()
command like this:

my $pid = fork()

if ( $pid == 0 ) {
  System("C:\\Progra~1\\Putty\\putty.exe");
  exit 0;
}


I don't really know much about GUIs with Perl, but I did look into this for a 
web server running modperl and you might find something helpful there.  Here 
are two links I bookmarked:

http://www.perl.com/pub/a/2003/01/07/mod_perl.html
http://modperlbook.org/html/10-2-3-Detaching-the-Forked-Process.html

What I do is:

-----
use POSIX 'setsid';

$SIG{CHLD} = 'IGNORE';
my $kid = fork;
if (!defined $kid) {
 ##  could not fork
}
elsif ($kid == 0) {
 $SIG{CHLD} = 'DEFAULT';
 setsid () or die "Can't start a new session:  $!";
## run system and then exit
}

##  Parent process continues from here
-----


The above is abbreviated from what I have, but I think you can look up setsid, 
$SIG{CHLD}, etc. to see if it applies to your GUI system.  Good luck!

Ray


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to