1Carp(3) User Contributed Perl Documentation Carp(3)
2
3
4
6 Gtk2::Ex::Carp - GTK+ friendly "die()" and "warn()" functions.
7
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
18 # new functions for showing extended error information:
19
20 # like warn(), but shows a dialog with extra information
21 # in an expandable text entry:
22 worry($SHORT_MESSAGE, $EXTENDED_INFORMATION);
23
24 # like worry(), but fatal:
25 wail($SHORT_MESSAGE, $EXTENDED_INFORMATION);
26
28 This module exports four functions, of which two override the standard
29 "die()" and "warn()" functions, and two which allow for extended error
30 reporting. When called, these functions display a user-friendly message
31 dialog window.
32
33 The "die()" function in this module actually replaces the core "die()"
34 function, so any modules you've loaded may die will use former instead
35 of the latter. "die()" will also print the error message to "STDERR"
36 and will exit the program (with the appropriate exit code) when the
37 dialog is dismissed.
38
39 The "warn()" function will also print a message to "STDERR", but will
40 allow the program to continue running when the dialog is dismissed.
41
42 EXTRA FUNCTIONS
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 This module also installs "warn()" as a Glib exception handler. Any
50 unhandled exceptions will be presented to the user in a warning dialog.
51
52 PROGRAM FLOW
53 Note that all the functions in this module create dialogs and use the
54 "run()" method, so that the standard Glib main loop is blocked until
55 the user responds to the dialog.
56
58 The dialogs that are created use the standard GNOME layout, with a bold
59 "title" label above the main message. The text for these labels is
60 taken from two package variables that may be altered to suit your
61 needs:
62
63 $Gtk2::Ex::Carp::FATAL_ERROR_MESSAGE = 'Fatal Error';
64 $Gtk2::Ex::Carp::WARNING_ERROR_MESSAGE = 'Warning';
65 $Gtk2::Ex::Carp::EXTENDED_EXPANDER_LABEL = 'Details:';
66
67 However, if the "Locale::gettext" module is available on the system,
68 and your application uses it, these variables will be automagically
69 translated, as long as these default values are translated in your .mo
70 files.
71
73 Gtk2, Carp, Locale::gettext
74
76 Gavin Brown (gavin dot brown at uk dot com)
77
79 (c) 2005 Gavin Brown. All rights reserved. This program is free
80 software; you can redistribute it and/or modify it under the same terms
81 as Perl itself.
82
83
84
85perl v5.12.0 2005-09-23 Carp(3)