pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:
I'm writing a convenience module that makes it easy to add debugging output to quick scripts. I'd like to make some tests ala Test::More and I'm wondering what's the best way to test based on the printed or warned output from a module?
Can I do something like E.G.:
... or something similer... possibly better....?grab_stdout($foo); print 'gabba gabba hey'; ungrab_stdout(); ok($foo eq 'gabba gabba hey`) || diag "didn't print 'gabba gabba hey' to stdout.";
Basically, I want to test if the stuff I wanted to send to stdout/stderr did in fact go to stout/stderr.
Thanks!
-Pileofrogs
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Testing a module's stdout/stderr
by Old_Gray_Bear (Bishop) on Mar 24, 2007 at 00:57 UTC | |
|
Re: Testing a module's stdout/stderr
by kyle (Abbot) on Mar 24, 2007 at 00:56 UTC | |
|
Re: Testing a module's stdout/stderr
by grinder (Bishop) on Mar 24, 2007 at 09:59 UTC | |
|
Re: Testing a module's stdout/stderr
by Sidhekin (Priest) on Mar 24, 2007 at 12:01 UTC |