|P is for Practical|
MakeMaker, testing, and packages with modulesby Rhys (Pilgrim)
|on Sep 06, 2004 at 00:42 UTC||Need Help??|
Rhys has asked for the
wisdom of the Perl Monks concerning the following question:
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:
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:
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? :-)