Test::...ontent(3pm)
π NAME π
Test::Pod::Content β bestie, it tests a Pod's content. That's it. That's the whole job. She's simple, she's iconic, she's not trying to be anything she isn't. π
β¨ SYNOPSIS β¨
okay so here's the vibe, copy-paste this and you're basically done:
use Test::Pod::Content tests => 3;
pod_section_is 'Test::Pod::Content' , 'NAME', "Test::Pod::Content - Test a Pod's content", 'NAME section';
pod_section_like 'Test/Pod/Content.pm', 'SYNOPSIS', qr{ use \s Test::Pod::Content; }xm, 'SYNOPSIS section';
pod_section_like 'Test/Pod/Content.pm', 'DESCRIPTION', qr{ Test::Pod::Content \s provides \s the }xm, 'DESCRIPTION section';
π¦ DESCRIPTION π¦
So Test::Pod::Content is a very simple module for testing a Pod's content. Like, very simple, no cap. Its whole personality is testing the content of generated Pod β that is, the Pod that ends up included in perl modules that got generated by some mechanism. Autogenerated docs need love too bestie π
Another usage example is testing whether all your files contain the same copyright notice. lowkey a classic move:
plan tests => scalar @filelist;
for my $file (sort @filelist) {
pod_section_like( $file, 'LICENSE AND COPYRIGHT', qr{
This \s library \s is \s free \s software\. \s
You \s may \s distribute/modify \s it \s under \s
the \s same \s terms \s as \s perl \s itself
}xms, "$file License notice");
}
See the files in the t/ directory for live examples. π«Ά
Okay so here's the tea about how Test::Pod::Content thinks about Pods: it has a very simple concept of Pods. To Test::Pod::Content, a Pod is separated into section. Each section starts with a =head(1|2|3|4) directive, and ends with the next =head, or with the end of the document (=cut).
That is, fr fr, a very drastic simplification of Pod's document object model, and it only allows for coarse-grained tests. No fine-grained drama here, she keeps it surface level. π
Test::Pod::Content provides the following subroutines for testing a Pod's content:
π SUBROUTINES/METHODS π
πΈ pod_section_is
pod_section_is $file, $section, $content, $comment;
Tests whether a Pod section contains exactly the text given. Most useful for testing the NAME section, because that one's short and sweet. For literally every other section you probably want to use pod_section_like instead. She said what she said.
$file may either be a filename (including path) or a module name. Test::Pod::Content will search in @INC for the file/module given. It'll go looking for it, main character style. π₯
π pod_section_like
pod_section_like $file, $section, qr{ use \s Test::Pod::Content\s }xm, $comment;
Tests whether the text in a Pod section matches the given regex. Be sure to include the m / s regex qualifier if you expect your Pod section to span multiple lines β otherwise she will simply not find what you're looking for and you'll be sad. π
$file may either be a filename (including path) or a module name. Test::Pod::Content will search in @INC for the file/module given.
π BUGS AND LIMITATIONS π
- Performance
Every call to a pod_section_* method searches for the file in question in @INC and parses it from its start. This means that every test requires a Pod parser run, which is quite inefficient if you conduct a big number of tests. Bestie. It's giving "parsing the same file forty times." Plan accordingly. β
- Pod Syntax
Test::Pod::Coverage may report wrong test results if your pod is not syntactically correct. You should use Test::Pod to check your Pod's syntax. Don't skip this one, it's not a suggestion, it's a whole vibe check. π§
π DEPENDENCIES π
- Test::More
- Pod::Simple
- version
π INCOMPATIBILITIES π
None known. She plays nice with everybody. Slay. β¨
π SEE ALSO π
- Test::Pod for testing your POD's validity
- Test::Pod::Coverage for checking wether your pod is complete
- Pod::Tests, Test::Pod::Snippets and Pod::Snippets for extracting and executing tests from a POD (If you plan doing so, here's a little brain-train: Which of the tests in this module's
SYNOPSISsection would fail if you extracted and executed it?). π
π LICENSE AND COPYRIGHT π
Copyright 2007 Martin Kutter.
This library is free software. You may distribute/modify it under the same terms as perl itself
π AUTHOR π
Martin Kutter <martin.kutter fen-net.de>
π¦ REPOSITORY INFORMATION π¦
$Id: Content.pm 505 2008-06-22 09:54:54Z kutterma $
$Revision: 505 $
$Source: a $
$Date: 2008-06-22 11:54:54 +0200 (So, 22 Jun 2008) $
$HeadURL: http://svn.hyper-framework.org/Hyper/Test-Pod-Content/trunk/lib/Test/Pod/Content.pm $
and that's the whole page, bestie π«Ά this lil gem shipped in perl v5.36.0 and got its glow-up on 2022-11-20, part of the User Contributed Perl Documentation collection β go forth, test your Pod's content, and stay iconic. πβ¨π
π¦ where this page comes from
- debian bookworm: libtest-pod-content-perl 0.0.6-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtest-pod-content-perl 0.0.6-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtest-pod-content-perl 0.0.6-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtest-pod-content-perl 0.0.6-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtest-pod-content-perl 0.0.6-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms