Re: 2 questions regarding a perl daemon with a GTK interface



On 05/11/01 gfricke hushmail com wrote:
Thank you to all those who responded to my initial post.  I have since successfully 
implemented the "delete_event" signal to spawn my exit dialog window, so 
problem 2 is solved :)  However, I'm note sure the solutions given for my 
first problem work in my case (I could be wrong, it may be exactly what 
I need but I have goten it to work yet).  What I need is the ability to 
start and stop the daemon dependant on what buttons are clicked.  I have 
tried to implement this by way of a variable "$daemonStarted" equal to 1 
for true and 0 for false.  I used the fork command and wrote a condition 
that basically says, if $daemonStarted then listen for request else do nothing. 
 Unfortunately, I discovered that when I click the start daemon button, 
the gui child process changes the value of its copy of $daemonStarted but 
the parent process' variable remained unchanged.  I guess what I really 
need is a way to have the child process and the parent process access/modify 
the same variables, or for Gtk to somehow sit in the background, avoid the 
use of fork and allow a daemon loop to execute at the same time.  Any suggestions/links/examples 
would be greatly appreciated.  Thanks in advance.

Reading the perlipc manpage could shed some light if you use fork().
If you don't use fork, the input_add callbacks are the right way to do it
as was suggested.

lupus

-- 
-----------------------------------------------------------------
lupus debian org                                     debian/rules
lupus ximian com                             Monkeys do it better




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