perlquestion
Rhys
Okay, so I've built this big Perl app. It started a long time ago as a giant kludge, since I didn't know squat about decent package-building practices, and not that much about good programming (although enough that the thing worked and wasn't <i>too</i> hard to maintain).
<p>
Years have gone by, and the app now has POD (which needs updating), several included modules, and gets built/installed with MakeMaker. All very cool so far.
<p>
My questions involve testing and the modules. At present, I can't even do a simple t/Basic.t test that does <code>use MyApp::EachMod;</code> because I <code>use SNMP;</code> (from [http://net-snmp.sourceforge.net/|Net-SNMP]). On RedHat, anyway, this fails with:
<p>
<code>
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/Basic....Can't load '/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/auto/SNMP/SNMP.so' for module SNMP: /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/auto/SNMP/SNMP.so: undefined symbol: PerlIO_fprintf at /usr/lib/perl5/5.8.0/i386-linux-thread-multi/DynaLoader.pm line 229, <DATA> line 48.
</code>
<p>
According to the net-snmp-users list archive, this is fixed in Net-SNMP-5.1, whereas RHEL is still using 5.0.9, but I digress...
<p>
Anyway, I can only think of two generic tests that one can run on a given module/script/chunk of code. They are:
<p>
<ol>
<li><code>perl -wc filename</code></li>
<li><code>perl -e'use mod;'</code> (modules only)</li>
</ol>
<p>
In the 'big app', my current t/Basic.t does <code>use MyApp::EachMod;</code> on any module that doesn't <code>use SNMP;</code> for the moment, and another little package I built to distribute a bunch of little scripts using a simple Makefile does <code>perl -wc $(PERLFILES)</code>, when I do <code>make test</code> or <code>make check</code>. I also have <code>use strict;</code> in everything (although I don't <code>use warnings;</code>).
<p>
<b>SO...</b> aside from attempting to give each piece of code a known set of inputs and looking for a known set of outputs (stuff that <code>Test::More</code> is good at), are there any other generic tests or procedures that folks use to make sure their code doesn't have junk in it?
<p>
More importantly, is there a TFM I should R on this topic? :-)
<p>
--J