1Carp(3)               User Contributed Perl Documentation              Carp(3)
2
3
4

NAME

6       Gtk2::Ex::Carp - GTK+ friendly "die()" and "warn()" functions.
7

SYNOPSIS

9               use Gtk2::Ex::Carp;
10
11               # these override the standard Perl functions:
12
13               warn('i told you not to push that button!');
14
15               die('an ignominious death');
16
17               # new functions for showing extended error information:
18
19               # like warn(), but shows a dialog with extra information
20               # in an expandable text entry:
21               worry($SHORT_MESSAGE, $EXTENDED_INFORMATION);
22
23               # like worry(), but fatal:
24               wail($SHORT_MESSAGE, $EXTENDED_INFORMATION);
25

DESCRIPTION

27       This module exports four functions, of which two override the standard
28       "die()" and "warn()" functions, and two which allow for extended error
29       reporting. When called, these functions display a user-friendly message
30       dialog window.
31
32       The "die()" function in this module actually replaces the core "die()"
33       function, so any modules you've loaded may die will use former instead
34       of the latter. "die()" will also print the error message to "STDERR"
35       and will exit the program (with the appropriate exit code) when the
36       dialog is dismissed.
37
38       The "warn()" function will also print a message to "STDERR", but will
39       allow the program to continue running when the dialog is dismissed.
40
41       EXTRA FUNCTIONS
42
43       The "worry()" and "wail()" functions behave just like "warn()" and
44       "die()", respectively, except that they allow you to provide additional
45       information. A second argument, which can contain additional error
46       information, is used to fill a text box inside an expander.
47
48       HANDLING GLIB EXCEPTIONS
49
50       This module also installs "warn()" as a Glib exception handler. Any
51       unhandled exceptions will be presented to the user in a warning dialog.
52
53       PROGRAM FLOW
54
55       Note that all the functions in this module create dialogs and use the
56       "run()" method, so that the standard Glib main loop is blocked until
57       the user responds to the dialog.
58

LOCALISATION ISSUES

60       The dialogs that are created use the standard GNOME layout, with a bold
61       "title" label above the main message. The text for these labels is
62       taken from two package variables that may be altered to suit your
63       needs:
64
65               $Gtk2::Ex::Carp::FATAL_ERROR_MESSAGE            = 'Fatal Error';
66               $Gtk2::Ex::Carp::WARNING_ERROR_MESSAGE          = 'Warning';
67               $Gtk2::Ex::Carp::EXTENDED_EXPANDER_LABEL        = 'Details:';
68
69       However, if the "Locale::gettext" module is available on the system,
70       and your application uses it, these variables will be automagically
71       translated, as long as these default values are translated in your .mo
72       files.
73

SEE ALSO

75       Gtk2, Carp, Locale::gettext
76

AUTHOR

78       Gavin Brown (gavin dot brown at uk dot com)
79
81       (c) 2005 Gavin Brown. All rights reserved. This program is free soft‐
82       ware; you can redistribute it and/or modify it under the same terms as
83       Perl itself.
84
85
86
87perl v5.8.8                       2005-09-23                           Carp(3)
Impressum