loris has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I am doing the following:

#!perl -T use Test::More; eval "use Test::Pod::Coverage 1.04"; plan tests => 1; pod_coverage_ok( "My::Flaky::Module");

The test fails with

# Failed test 'Pod coverage on My::Flaky::Module' # at /usr/local/share/perl5/Test/Pod/Coverage.pm line 133. # My::Flaky::Module: requiring 'My::Flaky::Module' failed

The failure is caused by

use Date::Manip;

in my module - if I comment it out, the test passes. I assume the problem is that Date::Manip doesn't contain any POD, so how can I prevent the test from being applied to the included modules?

Thanks,

loris

Replies are listed 'Best First'.
Re: Test::Pod:Coverage: excluding 'used' modules
by tobyink (Canon) on Nov 15, 2019 at 13:12 UTC

    Pod::Coverage (which Test::Pod::Coverage uses) already distinguishes between imported subs and ones you've defined yourself, so unless Date::Manip is doing something weird (which it isn't), this shouldn't be a problem.

    I only get that particular error message (requiring 'My::Module' failed) if the module can't actually be compiled; nothing to do with the pod. My guess is Date::Manip isn't installed properly on your system. It's not a core module, so perhaps you just don't have it at all.

      I also expected that Pod::Coverage would exclude the imported modules. However, I do have Date::Manip on my system and the unit tests which rely on it pass. None of the other included modules causes a problem, so maybe Date::Manip is doing something weird?

      Thanks,

      loris

        I was quite vague about "doing something weird". Specifically, I was alluding to installing subs in the caller package in such a way that they don't look like they've been imported. This can be achieved using Sub::Util/Sub::Name or eval, but Date::Manip isn't doing that.

        I really do think your test script is having problems even loading Date::Manip. Is @INC the same for this pod test as for your other tests?