Pod::Coverage(3pm) | User Contributed Perl Documentation | Pod::Coverage(3pm) |
Pod::Coverage - Checks if the documentation of a module is comprehensive
# in the beginnning... perl -MPod::Coverage=Pod::Coverage -e666 # all in one invocation use Pod::Coverage package => 'Fishy'; # straight OO use Pod::Coverage; my $pc = Pod::Coverage->new(package => 'Pod::Coverage'); print "We rock!" if $pc->coverage == 1;
Developers hate writing documentation. They'd hate it even more if their computer tattled on them, but maybe they'll be even more thankful in the long run. Even if not, perlmodstyle tells you to, so you must obey.
This module provides a mechanism for determining if the pod for a given module is comprehensive.
It expects to find either a "=head(n>1)" or an "=item" block documenting a subroutine.
Consider:
# an imaginary Foo.pm
package Foo;
=item foo The foo sub = cut sub foo {} sub bar {} 1; __END__
In this example "Foo::foo" is covered, but "Foo::bar" is not, so the "Foo" package is only 50% (0.5) covered
"package" the name of the package to analyse
"private" an array of
regexen which define what symbols are regarded as private (and so need
not be documented) defaults to [ qr/^_/, qr/^(un)?import$/,
qr/^DESTROY$/, qr/^AUTOLOAD$/, qr/^bootstrap$/,
qr/^(TIE( SCALAR | ARRAY | HASH | HANDLE ) |
FETCH | STORE | UNTIE | FETCHSIZE | STORESIZE |
POP | PUSH | SHIFT | UNSHIFT | SPLICE | DELETE |
EXISTS | EXTEND | CLEAR | FIRSTKEY | NEXTKEY | PRINT | PRINTF |
WRITE | READLINE | GETC | READ | CLOSE | BINMODE | OPEN |
EOF | FILENO | SEEK | TELL | SCALAR )$/x,
qr/^( MODIFY | FETCH )_( REF | SCALAR | ARRAY | HASH | CODE |
GLOB | FORMAT | IO )_ATTRIBUTES$/x,
qr/^CLONE(_SKIP)?$/, ]
This should cover all the usual magical methods for tie()d objects, attributes, generally all the methods that are typically not called by a user, but instead being used internally by perl.
"also_private" items are appended to the private list
"trustme" an array of regexen which define what symbols you just want us to assume are properly documented even if we can't find any docs for them
If "pod_from" is supplied, that file is parsed for the documentation, rather than using Pod::Find
If "nonwhitespace" is supplied, then only POD sections which have non-whitespace characters will count towards being documented.
Note, private and 'trustme' identifiers will be skipped.
As with "naked", private and 'trustme' identifiers will be skipped.
In order to allow internals debugging, while allowing the optimiser to do its thang, "Pod::Coverage" uses constant subs to define how it traces.
Use them like so
sub Pod::Coverage::TRACE_ALL () { 1 } use Pod::Coverage;
Supported constants are:
Well that's all there is so far, are you glad you came?
These abstract methods while functional in "Pod::Coverage" may make your life easier if you want to extend "Pod::Coverage" to fit your house style more closely.
NOTE Please consider this interface as in a state of flux until this comment goes away.
You probably won't need to override this one.
Return an arrayref or undef on fail.
Due to the method used to identify documented subroutines "Pod::Coverage" may completely miss your house style and declare your code undocumented. Patches and/or failing tests welcome.
Test::More, Devel::Cover
Richard Clamp <richardc@unixbeard.net>
Michael Stevens <mstevens@etla.org>
some contributions from David Cantrell <david@cantrell.org.uk>
Copyright (c) 2001, 2003, 2004, 2006, 2007, 2009 Richard Clamp, Michael Stevens. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2020-05-17 | perl v5.30.0 |