NAME
X11::Fvwm::Defaults - X11::Fvwm default packet handlers for some packet types
SYNOPSIS
use X11::Fvwm;
use X11::Fvwm::Defaults 'FvwmError';
$handle = new X11::Fvwm;
$handle->initModule;
$handle->addHandler(M_ERROR, \&FvwmError);
...
$handle->eventLoop;
$handle->endModule;
DESCRIPTION
The X11::Fvwm package is designed to provide access via Perl 5 to the module API of Fvwm 2. This code is based upon Fvwm 2.0.45 beta.
The X11::Fvwm::Defaults package is intended to offer some simple handlers for those packets that lend themselves to such, in an effort to enourage code-reuse and to simplify development.
ROUTINES
There are currently two routines available for import. Neither are exported by default, so you must explicitly request those routines desired when you use the Defaults package. Both of these are for the M_ERROR packet:
- FvwmError
-
This packet emits the text of the error sent by Fvwm to STDERR using the Carp package from the Perl core, specifically the routine carp. This routine by default includes some stack-trace information in the generated output, which may aid in tracking down the problem in question. You may also wish to look at the special signal-class
__WARN__
, documented in perlfunc.This does not suppress the error message that Fvwm itself displays to STDERR, which will be the same source to which your application writes (unless you use $SIG{__WARN__} to completely re-direct the messages).
- TkFvwmError
-
This handler creates a dialog box using the Tk widgets to notify you that an error has been reported by Fvwm. The dialog has three buttons, labelled "Exit", "Stack Trace" and "Dismiss". Selecting the "Dismiss" button closes the dialog, and allows your application to continue (the TkFvwmError routine grabs the pointer until the dialog is closed). Choosing the "Exit" button causes the handler to return a zero (0) exit code to the processPacket method, which in turn triggers the exit handlers and terminates the running module. If the "Stack Trace" button is pressed, then a current trace of the stack will be produced, showing the sequence of calls that led up to the error. After exiting that window, the application will continue as if the "Dismiss" button had been pressed.
As with the non-Tk routine above, Fvwm will still produce its own error message that this routine has no power to suppress.
EXAMPLES
The PerlTkWL sample script uses the TkFvwmError default to handle any instances of Fvwm errors. To force this behavior, bind a mouse-button to invoke a non-existant module, then click that button in an active PerlTkWL.
BUGS
None known.
CAVEATS
Currently, only the M_ERROR packet type has any defaults to offer. Other types don't appear to lend themselves well to default handlers.
I don't really like the way stack traces are displayed in the TkFvwmError routine, but it will have to do for now.
AUTHOR
Randy J. Ray <randy@byz.org>