The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tk::Stderr - capture standard error output, display in separate window

SYNOPSIS

        use Tk::Stderr;

        $mw = MainWindow->new->InitStderr;
        print STDERR 'stuff';   ## goes to standard error window
        warn 'eek!';            ## likewise

DESCRIPTION

This module captures that standard error of a program and redirects it to a read only text widget, which doesn't appear until necessary. When it does appear, the user can close it; it'll appear again when there is more output.

METHODS

These are actually added to the MainWindow class.

$mw->InitStderr;

The first time this method called, it does the following things:

o

Creates a MainWindow holding a read-only scrollable text widget, and withdraws this window until it's actually needed.

o

Ties STDERR to a special handle that adds the output to this text widget.

o

Installs a $SIG{__WARN__} handler that redirects the output from warn to this window as well (by printing it to STDERR).

On the remaining calls, it:

o

Increments a reference count of "other" MainWindows.

o

Installs an OnDestroy handler that decrements this reference count, so that it can detect when it's the only MainWindow left and destroy itself.

$errwin = $mw->StderrWindow;

Returns a reference to the main window holding the text. You can use this to configure the window itself or the widgets it contains. The only advertised subwidget is 'text', which is the scrolled read-only text widget.

$old = $mw->RedirectStderr($boolean);

Enables or disables the redirection of standard error to the text window. Set $boolean to true to enable redirection, false to disable it. Returns the previous value of the enabled flag.

If InitStderr has never been called, this routine will call it if $boolean is true.

AUTHOR

Kevin Michael Vail <kevin@vaildc.net>