Your Mother has asked for the wisdom of the Perl Monks concerning the following question:
When doing unit/exception tests (especially in stuff like Moose that's stacktrace heavy) STDERR can get ugly and cloud the (terminal/human) results making PASSes unpleasant to look at and making it hard to find the germane bits in FAILs. So, this-
close STDERR or warn "Couldn't close STDERR"; open STDERR, ">", "/dev/null" or exit 1; # Nope: die "Can't open STDER +R to /dev/null: $!";
Is that best, most sane way to do it? Is there a CPAN alternative to avoid cookie cutter propagation of the snippet? WWJAPHD?
Update: noticed the problem with dieing after closing STDERR. Der...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Silencing STDERR for tests
by roboticus (Chancellor) on Dec 30, 2010 at 18:14 UTC | |
|
Re: Silencing STDERR for tests
by afoken (Chancellor) on Dec 31, 2010 at 10:03 UTC |