From 43c3f4a8b5a487239e794a4ee67ca867648ee00b Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Quelin?= Date: Tue, 20 Jan 2009 10:07:44 +0100 Subject: [PATCH] better hook to capture stderr wrapping our own stuff in a module only works for said module. better set that in main program, redirecting whole stdout / stderr --- bin/cpan2pkg | 7 +++++++ lib/App/CPAN2Pkg/Curses.pm | 9 --------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/bin/cpan2pkg b/bin/cpan2pkg index 3466e74..171d0c0 100755 --- a/bin/cpan2pkg +++ b/bin/cpan2pkg @@ -17,6 +17,13 @@ use lib "$Bin/../lib"; #use Getopt::Euclid; use App::CPAN2Pkg::Curses; +use Hook::Output::File; + +my $hook; +$hook = Hook::Output::File->redirect( + stdout => '/tmp/cpan2pkg.stdout', + stderr => '/tmp/cpan2pkg.stderr', +); my $ui = App::CPAN2Pkg::Curses->spawn; $ui->mainloop; diff --git a/lib/App/CPAN2Pkg/Curses.pm b/lib/App/CPAN2Pkg/Curses.pm index baa6e6e..5ee8c98 100644 --- a/lib/App/CPAN2Pkg/Curses.pm +++ b/lib/App/CPAN2Pkg/Curses.pm @@ -17,15 +17,6 @@ use POE; use base qw{ Curses::UI::POE }; -# debugging with curses is not easy -if ( exists $ENV{CPAN2PKG_DEBUG} ) { - $SIG{__DIE__} = $SIG{__WARN__} = sub { - open my $fh, '>>', 'stderr'; - print $fh @_; - }; - warn '-' x 40 . "\n"; -} - #-- # CONSTRUCTOR -- 2.11.4.GIT