Question
- TWiki version: (TWiki version: 01 Feb 2003)
- Perl version: 5.6.1
- Web server & version: Apache
- Server OS: SunOS? + Linux
- Web browser & version: Internet Explorer 6.0
- Client OS: Windows XP
--
AndyGlew - 18 Jun 2003
This is a bug report... I continue to make significant bug reports
in this support database, because it is the only thing resembling a
bug reporrting system I know of for twiki, and because nobody
has told me not to (or, if they have, they told me via twiki, not mail,
and I do not have notification set up.)
I started discussing this bug in
http://twiki.org/cgi-bin/view/Plugins/TreePluginDev,
but I think it is more comprehensive.
Original Problem
TreePlugin's tests woould not run.
Not "failed" - they just would not run, with errors such as
"Undefined function TWiki::getCgiQuery".
Basically, problems getting modules linked in.
Related Bitching and Moaning
It was not obvious how to run the TreePlugin tests.
I am guessing it was just "perl pluginTest.pl".
3:33pm: nope, it was "perl
TestRunner.pl".
Which had the same module dependency problem
(actually,
PluginTest.pm did).
Even after getting past these, the tests fail - but they probably fail
legitimately, because of issues with getCgiQuery.
TWiki really needs a standard test suite.
If the tests aren't run, they do no good.
Chasing the Problem
The TreePlugin/test/<nopPluginTest.pl bug
was caused by the fact that it use's TWiki::Func.
But, TWiki::Func depends on TWiki.pm
- and TWiki.pm was not loaded at this point in the test.
Meta discussion: should modules be freestanding?
It's the classic dependency problem: TWiki::Func depends on
TWiki.pm, but does not load it itself.
I am personally from the camp where modules should be freestanding.
All modules should load all modules they depend on.
Use IF statements or other conditionals to eliminate multiple
unnecessary loads.
(This is the same issue as in C/C++: should header files #include
everyone they depend on? My answer, again, is YES.)
It is trivial to test this. Simply do
perl <<EOF
use Module;
EOF
- if it does not have an error compiling, it has probably loaded
everything it needs. For that matter
perl <<EOF
use Module;
use Module;
EOF
can test if it is if-guarded appropriately.
What to do?
TWiki needs a test suite.
If I were a good TWiki citizen, I might write it.
But (1) I'm lazy, and (2) I'm on the verge of giving up
on TWiki, since I am
thinking about a CVS based wiki.
Answer