Discipulus has asked for the wisdom of the Perl Monks concerning the following question:
so that I can log to a file all the return output with useful information and in the right order..use MyLittlePlace::BrandNewMod qw(a b c); close STDERR; open(STDERR, ">&STDOUT") || die " uh uh ?! we mad ?! "; $|++;
Is a Rigth thing to do in my case? is better do it in the module in some way ? it is dangerous? it make sense?close STDERR; # no more redirect of handler # open(STDERR, ">&STDOUT") || die " uh uh ?! we mad ?! "; $|++; my $err_count = 0; $SIG{__WARN__} = sub { ++$err_count;print STDOUT @_ }; $SIG{__DIE__} = sub { ++$err_count;print STDOUT @_ }; #do all the stuff and at the end.. &advise_me($content) if $err_count > =; print $err_count, " ERROR",($err_count eq 1 ? '' : 'S' ), " IN $0\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: doubious about redefine $SIG{__WARN__}
by samtregar (Abbot) on May 12, 2008 at 17:09 UTC | |
by Discipulus (Canon) on May 13, 2008 at 11:05 UTC |