Test::Pod::No404s - Checks POD for http 404 links
#!/usr/bin/perl use strict; use warnings; use Test::More; eval "use Test::Pod::No404s"; if ( $@ ) { plan skip_all => 'Test::Pod::No404s required for testing POD'; } else { all_pod_files_ok(); }
Using this test module will check your POD for any http 404 links.
This module looks for any http(s) links in your POD and verifies that they will not return a 404. It uses LWP::UserAgent for the heavy lifting, and simply lets you know if it failed to retrieve the document. More specifically, it uses $response->is_error as the "test."
Normally, you wouldn't want this test to be run during end-user installation because they might have no internet! It is HIGHLY recommended that this be used only for module authors' RELEASE_TESTING phase. To do that, just modify the synopsis to add an env check :)
This function is what you will usually run. It automatically finds any POD in your distribution and runs checks on them.
Accepts an optional argument: an array of files to check. By default it checks all POD files it can find in the distribution. Every file it finds is passed to the pod_file_ok function.
pod_file_ok
pod_file_ok() will okay the test if there is no http(s) links present in the POD or if all links are not an error. Furthermore, if the POD was malformed as reported by Pod::Simple, the test will fail and not attempt to check the links.
pod_file_ok()
When it fails, pod_file_ok() will show any failing links as diagnostics.
The optional second argument TESTNAME is the name of the test. If it is omitted, pod_file_ok() chooses a default test name "404 test for FILENAME".
Automatically exports the two subs.
LWP::UserAgent
Pod::Simple
Test::Pod
You can find documentation for this module with the perldoc command.
perldoc Test::Pod::No404s
Search CPAN
http://search.cpan.org/dist/Test-Pod-No404s
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Test-Pod-No404s
CPAN Ratings
http://cpanratings.perl.org/d/Test-Pod-No404s
CPAN Forum
http://cpanforum.com/dist/Test-Pod-No404s
RT: CPAN's Request Tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Pod-No404s
CPANTS Kwalitee
http://cpants.perl.org/dist/overview/Test-Pod-No404s
CPAN Testers Results
http://cpantesters.org/distro/T/Test-Pod-No404s.html
CPAN Testers Matrix
http://matrix.cpantesters.org/?dist=Test-Pod-No404s
Git Source Code Repository
http://github.com/apocalypse/perl-test-pod-no404s
Please report any bugs or feature requests to bug-test-pod-no404s at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Pod-No404s. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-test-pod-no404s at rt.cpan.org
Apocalypse <apocal@cpan.org>
Thanks to the author of Test::Pod for the basic framework of this module!
Thanks to the POE guys for finding 404 links in their POD, and was the inspiration for this module.
Copyright 2010 by Apocalypse
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Test::Pod::No404s, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Pod::No404s
CPAN shell
perl -MCPAN -e shell install Test::Pod::No404s
For more information on module installation, please visit the detailed CPAN module installation guide.