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 too hard to maintain).

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.

My questions involve testing and the modules. At present, I can't even do a simple t/Basic.t test that does use MyApp::EachMod; because I use SNMP; (from Net-SNMP). On RedHat, anyway, this fails with:

PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_h +arness(0, 'blib/lib', 'blib/arch')" t/*.t t/Basic....Can't load '/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thr +ead-multi/auto/SNMP/SNMP.so' for module SNMP: /usr/lib/perl5/vendor_p +erl/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/Dyna +Loader.pm line 229, <DATA> line 48.

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...

Anyway, I can only think of two generic tests that one can run on a given module/script/chunk of code. They are:

  1. perl -wc filename
  2. perl -e'use mod;' (modules only)

In the 'big app', my current t/Basic.t does use MyApp::EachMod; on any module that doesn't use SNMP; for the moment, and another little package I built to distribute a bunch of little scripts using a simple Makefile does perl -wc $(PERLFILES), when I do make test or make check. I also have use strict; in everything (although I don't use warnings;).

SO... aside from attempting to give each piece of code a known set of inputs and looking for a known set of outputs (stuff that Test::More 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?

More importantly, is there a TFM I should R on this topic? :-)

--J


In reply to MakeMaker, testing, and packages with modules by Rhys

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.