I've created a distribution containing a top-level Makefile.PL and two
sub-directories, say, Foo and Bar, each with their own Makefile.PL's.
Tests for the entire distribution are contained in a top-level t/
sub-directory; the two module sub-directories don't have their own t/
sub-directories because the tests for each module depend on the other
module so it just made more sense to put all the tests together at the
top-level:
Makefile.PL
Foo/Makefile.PL
Bar/Makefile.PL
t/*.t
When I run "[n]make test" from the top-level, I find that after the
top-level tests have been run I get two messages printed out about the
sub modules not having any tests defined:
[...]
All tests successful.
'No tests defined for Foo extension.'
'No tests defined for Bar extension.'
Those message obviously come from the "test" target in the sub-directory
Makefile's. I would like to suppress them because they look slightly
alarming: It looks as if I haven't written tests for the Foo and Bar
modules, but really I have -- they're in the top-level t/ sub-directory.
So I added the following to Foo/Makefile.PL and Bar/Makefile.PL:
sub MY::test {
return "test :: \$(TEST_TYPE)\n" .
"\t\$(NOECHO) \$(NOOP)\n";
}
This works fine except that it now produces a warning about "Subroutine
MY::test redefined" when running "perl Makefile.PL". Presumably this is
because all the Makefile.PL's are require()'d and run in the same
process (rather than being run by separate perl sub-processes), so I've
effectively defined MY::test twice in the same program.
I can workaround it by only overriding MY::test in _one_ of the
sub-directories' Makefile.PL's, but I don't like that: It doesn't "feel
right" and I must be careful to do it in the _first_ one that the
top-level Makefile.PL runs otherwise it doesn't apply to all
sub-directories.
Is there a more elegant way to do what I'm trying to achieve?
- Steve
------------------------------------------------
Radan Computational Ltd.
The information contained in this message and any files transmitted with it are
confidential and intended for the addressee(s) only. If you have received this
message in error or there are any problems, please notify the sender immediately. The
unauthorized use, disclosure, copying or alteration of this message is strictly
forbidden. Note that any views or opinions presented in this email are solely those
of the author and do not necessarily represent those of Radan Computational Ltd. The
recipient(s) of this message should check it and any attached files for viruses: Radan
Computational will accept no liability for any damage caused by any virus transmitted
by this email.