traveler has asked for the wisdom of the Perl Monks concerning the following question:

I have a perl application that uses gtk-perl for its gui. It works really well :-). The program is event driven (timer and user input). One task it performs is to write out some status info to a file every few seconds. This is not really a good idea as the program that retrieves that info may go weeks without asking for it.

What I'd like to do is make an RPC call of some sort to the program to get the data (a less attractive alternative is shared memory). I read the issues with SOAP::Lite in this thread, but I am not sure the SOAP::Lite dispatcher can be integrated with the gtk+ dispatcher. I have seen instructions here how to integrate the C version of the SUN RPC mechanism with the C version of the Gtk dispatch routine.

My question is what kind of RPC to use. I have no problem writing my own polling routine as I currently poll other ports on a periodic basis in my server and I have semaphores of a sort to lock out critical sections.

Thanks, --traveler

Replies are listed 'Best First'.
Re: Best way to RPC with gtk-perl
by Flexx (Pilgrim) on Sep 14, 2002 at 00:02 UTC

    Hi!

    While I can't come up with a snipplet solution without some studying myself, maybe I can help with some plain brainstorming ideas (/msg me if you really, really want me to dig in ;)

    • Maybe plain singals will do? Apache, for example uses kill -USR1 `cat pidfile` to be signaled a change in it's config files.
    • I heard a workmate of mine mumble about using alarms to singal processes, but I don't know the details.
    • I wonder, do you have to do the writing out of status info in the interactive program, or could you have a seperate program simply be called by the retrieving program?
    • You could also use a listener to listen on a TCP port for incoming dump requests (and even answer on that socket, instead of writing things out to an intermediate file).

    Just a few ideas,
    so long,
    Flexx