Carp(3) User Contributed Perl Documentation Carp(3)NAMEGtk2::Ex::Carp - GTK+ friendly "die()" and "warn()" functions.
SYNOPSIS
use Gtk2::Ex::Carp;
# these override the standard Perl functions:
warn('i told you not to push that button!');
die('an ignominious death');
# new functions for showing extended error information:
# like warn(), but shows a dialog with extra information
# in an expandable text entry:
worry($SHORT_MESSAGE, $EXTENDED_INFORMATION);
# like worry(), but fatal:
wail($SHORT_MESSAGE, $EXTENDED_INFORMATION);
DESCRIPTION
This module exports four functions, of which two override the standard
"die()" and "warn()" functions, and two which allow for extended error
reporting. When called, these functions display a user-friendly message
dialog window.
The "die()" function in this module actually replaces the core "die()"
function, so any modules you've loaded may die will use former instead
of the latter. "die()" will also print the error message to "STDERR"
and will exit the program (with the appropriate exit code) when the
dialog is dismissed.
The "warn()" function will also print a message to "STDERR", but will
allow the program to continue running when the dialog is dismissed.
EXTRA FUNCTIONS
The "worry()" and "wail()" functions behave just like "warn()" and
"die()", respectively, except that they allow you to provide additional
information. A second argument, which can contain additional error
information, is used to fill a text box inside an expander.
HANDLING GLIB EXCEPTIONS
This module also installs "warn()" as a Glib exception handler. Any
unhandled exceptions will be presented to the user in a warning dialog.
PROGRAM FLOW
Note that all the functions in this module create dialogs and use the
"run()" method, so that the standard Glib main loop is blocked until
the user responds to the dialog.
LOCALISATION ISSUES
The dialogs that are created use the standard GNOME layout, with a bold
"title" label above the main message. The text for these labels is
taken from two package variables that may be altered to suit your
needs:
$Gtk2::Ex::Carp::FATAL_ERROR_MESSAGE = 'Fatal Error';
$Gtk2::Ex::Carp::WARNING_ERROR_MESSAGE = 'Warning';
$Gtk2::Ex::Carp::EXTENDED_EXPANDER_LABEL = 'Details:';
However, if the "Locale::gettext" module is available on the system,
and your application uses it, these variables will be automagically
translated, as long as these default values are translated in your .mo
files.
SEE ALSO
Gtk2, Carp, Locale::gettext
AUTHOR
Gavin Brown (gavin dot brown at uk dot com)
COPYRIGHT
(c) 2005 Gavin Brown. All rights reserved. This program is free
software; you can redistribute it and/or modify it under the same terms
as Perl itself.
perl v5.14.1 2005-09-23 Carp(3)