in reply to No tests run!

Is this really a question about how to conditionally load a module?

I believe so. I think that loading Test::More at runtime, with require, will do as you want:

sub run_tests { require Test::More; Test::More->import 'no_plan'; # ... }
Untested.

It is customary to separate testing from your code's runtime by using ExtUtil::MakeMaker's conventions to produce a standalone test suite. The 'make test' step of installation runs the tests before installation, relieving the code of keeping them around every time it's run.

You may be interested in Test::Inline.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: No tests run!
by hey_david (Sexton) on Jul 25, 2003 at 12:57 UTC
    Zaxo,

    Thanks! Your idea also works (with added parens around 'no_plan').

    I've heard of MakeMaker and intend to give it a look, along with ExtUtils::ModuleMaker.

    -David