<?xml version="1.0" encoding="windows-1252"?>
<node id="623040" title="Re: Refactoring Perl 1 - Extract Method" created="2007-06-24 00:50:45" updated="2007-06-23 20:50:45">
<type id="11">
note</type>
<author id="231973">
doom</author>
<data>
<field name="doctext">
&lt;BLOCKQUOTE&gt;
Test::Output is very useful to testing code that generates STDOUT or STDERR as this code does. 
&lt;/BLOCKQUOTE&gt;
I've been getting into [cpan://Test::Trap] of late, myself, which I think I've seen mentioned here.  It has a pretty simple interface, and you can use it to trap errors as well.
&lt;P&gt;
&lt;BLOCKQUOTE&gt;
 I highly recommend Ian Langworth and chromatic's Perl Testing, A Developer's Notebook if you're not comfortable with writing and maintaining tests.
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;
I like that book quite a bit, but what I would say is that if you're not into writing tests yet, you should look at the documentation for [cpan://Test::More].  There's no end of little tricks to writing tests (as in any kind of programming) but there's plenty of material to get started with right there in "Test::More" &lt;c&gt;[1]&lt;/c&gt;. 
&lt;P&gt;
I have this fear that at some point the standard practice for testing perl is going to involve frameworks so elaborate that writing tests is going to turn into a sub-specialty that people are going to be afraid to get involved with...
&lt;P&gt;
&lt;c&gt;[1]&lt;/c&gt; I have one complaint about the "Test::More" docs though: it's long since time they should stop directing newbies to "Test::Simple" first... "Test::More" is clearly the new standard.
&lt;P&gt;</field>
<field name="root_node">
622705</field>
<field name="parent_node">
622705</field>
</data>
</node>
