1Stderr(3) User Contributed Perl Documentation Stderr(3)
2
3
4
6 Tk::Stderr - capture standard error output, display in separate window
7
9 use Tk::Stderr;
10
11 $mw = MainWindow->new->InitStderr;
12 print STDERR 'stuff'; ## goes to standard error window
13 warn 'eek!'; ## likewise
14
16 This module captures that standard error of a program and redirects it
17 to a read only text widget, which doesn't appear until necessary. When
18 it does appear, the user can close it; it'll appear again when there is
19 more output.
20
22 These are actually added to the MainWindow class.
23
24 $mw->InitStderr;
25 The first time this method called, it does the following things:
26
27 o Creates a MainWindow holding a read-only scrollable text
28 widget, and withdraws this window until it's actually needed.
29
30 o Ties STDERR to a special handle that adds the output to this
31 text widget.
32
33 o Installs a $SIG{__WARN__} handler that redirects the output
34 from warn to this window as well (by printing it to STDERR).
35
36 On the remaining calls, it:
37
38 o Increments a reference count of "other" MainWindows.
39
40 o Installs an OnDestroy handler that decrements this reference
41 count, so that it can detect when it's the only MainWindow left
42 and destroy itself.
43
44 $errwin = $mw->StderrWindow;
45 Returns a reference to the main window holding the text. You can
46 use this to configure the window itself or the widgets it contains.
47 The only advertised subwidget is 'text', which is the scrolled
48 read-only text widget.
49
50 $old = $mw->RedirectStderr($boolean);
51 Enables or disables the redirection of standard error to the text
52 window. Set $boolean to true to enable redirection, false to
53 disable it. Returns the previous value of the enabled flag.
54
55 If InitStderr has never been called, this routine will call it if
56 $boolean is true.
57
59 Kevin Michael Vail <kevin@vaildc.net>
60
61
62
63perl v5.30.0 2019-07-26 Stderr(3)