SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG
DONATE


YUM REPOSITORY

 
 

MAN page from Fedora 13 Zim-0.29-1.fc13.noarch.rpm

Zim::GUI::Daemon

Section: User Contributed Perl Documentation (3)
Updated: 2010-02-10
Index 

NAME

Zim::GUI::Daemon - IPC module for the zim GUI 

SYNOPSIS

        # Daemon process        Zim::GUI::Daemon->daemonize( sub { ... } );        exit;        # Client process        Zim::GUI::Daemon->do('open', $notebook, $page);
 

DESCRIPTION

This module contains all the IPC code to make various processes work together.The idea is to have one process without a interface running as a daemon. Thisdaemon listens to a UNIX domain socket for commands. This daemon spawns clientsto open multiple notebooks. The daemon keeps filhandlers to the STDIN of eachclient to communicate with them.

This module is not object oriented because we only use a single instanceof the daemon per process anyway. 

METHODS

exists()
Returns boolean to check if we have a daemon or not.
do(CMD, @ARGS)
Method for the clients to pass a single command to the daemon.Arguments should be scalar and will be passed to the command routine.

Wrap this within method an "eval { }" block because it will die if nodaemon is listening.

list()
Method for clients to request a list of notebooks.Assumes that STDIN is flushed.
daemonize(CODE)
Unless $Zim::DEBUG is set this dissociates the current process from itsparent process (like your shell). Then it opens the daemon socket.

CODE is the callback that is called when a new client is opened in the child process. It should get the notebook and the page as arguments when called.

main()
Called after "daemonize()" to wait for input.Does not return untill a client calls the command ``quit''.
 

Commands

All commands have method that starts with ``ACTION_''. These are the routinesthat clients are allowed to call, so they are our public interface.

The daemon calls these with the PID of the client followed by any argumentspassed by the client. To call these remotely use "do()" and provide thearguments after PID for each function.

ACTION_open(PID, NOTEBOOK, PAGE, @ARGS)
If there is a child process open for NOTEBOOK it is called to open PAGE.Else a new child is spawn to open NOTEBOOK and PAGE.

NOTEBOOK and PAGE are both optional, PID is the PID of the calling client,not of the child handling NOTEBOOK. If NOTEBOOK is undefined a new child isspawn that could for example show the notebook dialog.

ACTION_run(PID, NAME, CLASS, @ARGS)
If there is no child with NAME run one using "CLASS-"run(@ARGS)>.Can be used by plugins to run a special process.
ACTION_register(PID, NAME)
Allows the child process to tell it's short name to the daemon.THis name does not need to be unique.
ACTION_list(PID)
Will print a list of open notebooks to STDIN of PID.Or to STDOUT if PID is not a child process.
ACTION_tell(PID, TO, @ARGS)
Pass @ARGS to a child process. TO can be either a PID or a NOTEBOOK.Used for testing or to interact directly with other process instances.
ACTION_broadcast(PID, @ARGS)
Send ARGS to all processes except the one that is broadcasting.
ACTION_quit(PID)
Quit the daemon if all children have exited.To quit all children try something like "broadcast Close FORCE".
 

Other routines

join_line(@STRING)
Function that serializes list into a single string.
split_line(STRING)
Function that splits line into list.
 

AUTHOR

Jaap Karssenberg (Pardus) <pardusAATTcpan.org>

Copyright (c) 2008 Jaap G Karssenberg. All rights reserved.This program is free software; you can redistribute it and/ormodify it under the same terms as Perl itself. 

SEE ALSO


 

Index

NAME
SYNOPSIS
DESCRIPTION
METHODS
Commands
Other routines
AUTHOR
SEE ALSO

This document was created byman2html,using the manual pages.