I'd like be to able to redirect warnings from the perl interpreter to a Tk
text widget:
#!/usr/bin/perl -w
use Tk;
$mw = MainWindow->new;
$text= $mw->Text( '-width' => 40, '-height' => 20)->pack;
tie *STDERR, ref $text, $text;
print STDERR "blah";
print $something;
MainLoop;
In the code above, the second print statement generates a warning (since
$something is undefined), but the warning is sent to STDERR on my console,
rather than the tied filehandle.
Any thoughts?
Cheers,
Pete
There is: Tk-Stderr
>> I'd like be to able to redirect warnings from the perl interpreter to a
>> Tk text widget:
[snip]
> There is: Tk-Stderr
Ah, thanks. Looking at the module i've been able to revise my code, and it
works a treat:
#!/usr/bin/perl -w
use Tk;
$mw = MainWindow->new;
$text= $mw->Text( '-width' => 40, '-height' => 20)->pack;
tie *STDERR, ref $text, $text;
$SIG{__WARN__} = sub { print STDERR @_ };