use strict; use warnings; use Test::More qw(no_plan); my $status = Status->new(); #how do I test this? $status->status('good'); # should be "ok" if the right message got printed $status->status('bad'); # should also be "ok" if the right warning got printed package Status; sub new { my $package = shift; my $self = {}; bless $self, $package; } sub status { my $self = shift; my $status = shift; if ($status eq 'good') { print "good status\n"; } else { warn "bad status\n"; } } 1;