If you have a module on CPAN consisting of several files and you want to test the POD with Test::Pod, this is a test that you can add to your t/ directory and MANIFEST. The code assumes that your modules lie below a lib/ directory instead together with the administrative files. For example the files that go together with the test below are :
lib/WWW/Mechanize/FormFiller.pm
lib/WWW/Mechanize/FormFiller/Value.pm
lib/WWW/Mechanize/FormFiller/Value/Fixed.pm
lib/WWW/Mechanize/FormFiller/Value/Default.pm
lib/WWW/Mechanize/FormFiller/Value/Callback.pm
lib/WWW/Mechanize/FormFiller/Value/Interactive.pm
lib/WWW/Mechanize/FormFiller/Value/Random.pm

Comments on portability etc. are very welcome, as I want to release modules using this test via CPAN and I don't want too many portability errors :-)

use strict; use vars qw( @modules ); BEGIN { @modules = qw( WWW::Mechanize::FormFiller WWW::Mechanize::FormFiller::Value WWW::Mechanize::FormFiller::Value::Fixed WWW::Mechanize::FormFiller::Value::Default WWW::Mechanize::FormFiller::Value::Callback WWW::Mechanize::FormFiller::Value::Interactive WWW::Mechanize::FormFiller::Value::Random )}; use Test::More tests => scalar @modules; sub test_module_pod { my $modulename; for $modulename (@_) { # We assume that we live in the t/ directory, and that our main mo +dule lives below t/../lib/ my @modulepath = (File::Spec->splitpath($FindBin::Bin)); pop @modulepath; push @modulepath, "lib",split /::/, $modulename; my $constructed_module_name = File::Spec->catfile(@modulepath) . " +.pm"; pop @modulepath; pod_ok($constructed_module_name); }; }; SKIP: { eval { require FindBin; FindBin->import() }; skip "Need FindBin to check the Pod", scalar @modules if $@; eval { require File::Spec; File::SpecBase->import() }; skip "Need File::Spec to check the Pod",scalar @modules if $@; eval { require Test::Pod; Test::Pod->import() }; skip "Need Test::Pod to check the Pod",scalar @modules if $@; test_module_pod($_) for @modules; # make warnings.pm happy $FindBin::Bin eq $FindBin::Bin or 1; };

In reply to Test the Pod of your files by Corion

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.