in reply to How do you Test that the right output got printed?

You use one of the Test methods, and return a value from your sub/method instead of printing to STDOUT or STDERR:

use Test::More qw(no_plan); my $status = Status->new(); is ($status->status('good'), 'good'); is ($status->status('bad'), 'good'); package Status; sub new { my $package = shift; my $self = {}; bless $self, $package; } sub status { my $self = shift; my $status = shift; if ($status eq 'good') { return "good"; } else { return "bad"; } }
I don't recommend having a method print directly -- let the client do the printing.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)