in reply to use Test; and output
So, what's the best way to check output? Do you decided absolutely what the output will look like at the beginning of the project and hardcode it into a test? Do you just ignore testing output, and look at the output after every change? Do you do something completely different?
Some suggestions:
In general I try and make output layers as thin as possible, do as little as possible, and have as little knowledge about what they're presenting as possible. For example rather than having:
my $o = FribbleList::HTML->new; $o->output;
I'd tend to have something like
my $html_list_output = ListOutput::HTML->new; my $o = FribbleList->new( output => $html_list_output ); $o->output; # really does $html_list_output->output( $o->list );
so I can test my FribbleList class completely independently of my ListOutput::HTML class.
|
|---|