SYNOPSIS

  # 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;

DESCRIPTION

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 \*(C`=head(n>1)\*(C' or an \*(C`=item\*(C' 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 \*(C`Foo::foo\*(C' is covered, but \*(C`Foo::bar\*(C' is not, so the \*(C`Foo\*(C' package is only 50% (0.5) covered

Methods

Creates a new Pod::Coverage object. \*(C`package\*(C' the name of the package to analyse \*(C`private\*(C' 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/^(\s-1TIE\s0( \s-1SCALAR\s0 | \s-1ARRAY\s0 | \s-1HASH\s0 | \s-1HANDLE\s0 ) |
             \s-1FETCH\s0 | \s-1STORE\s0 | \s-1UNTIE\s0 | \s-1FETCHSIZE\s0 | \s-1STORESIZE\s0 |
             \s-1POP\s0 | \s-1PUSH\s0 | \s-1SHIFT\s0 | \s-1UNSHIFT\s0 | \s-1SPLICE\s0 | \s-1DELETE\s0 |
             \s-1EXISTS\s0 | \s-1EXTEND\s0 | \s-1CLEAR\s0 | \s-1FIRSTKEY\s0 | \s-1NEXTKEY\s0 | \s-1PRINT\s0 | \s-1PRINTF\s0 |
             \s-1WRITE\s0 | \s-1READLINE\s0 | \s-1GETC\s0 | \s-1READ\s0 | \s-1CLOSE\s0 | \s-1BINMODE\s0 | \s-1OPEN\s0 |
             \s-1EOF\s0 | \s-1FILENO\s0 | \s-1SEEK\s0 | \s-1TELL\s0 | \s-1SCALAR\s0 )$/x,
        qr/^( \s-1MODIFY\s0 | \s-1FETCH\s0 )_( \s-1REF\s0 | \s-1SCALAR\s0 | \s-1ARRAY\s0 | \s-1HASH\s0 | \s-1CODE\s0 |
                                 \s-1GLOB\s0 | \s-1FORMAT\s0 | \s-1IO\s0 )_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. \*(C`also_private\*(C' items are appended to the private list \*(C`trustme\*(C' 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 \*(C`pod_from\*(C' is supplied, that file is parsed for the documentation, rather than using Pod::Find If \*(C`nonwhitespace\*(C' is supplied, then only \s-1POD\s0 sections which have non-whitespace characters will count towards being documented. Gives the coverage as a value in the range 0 to 1 \*(C`$object->coverage\*(C' may return \*(C`undef\*(C', to indicate that it was unable to deduce coverage for a package. If this happens you should be able to check \*(C`why_unrated\*(C' to get a useful excuse. Returns a list of uncovered routines, will implicitly call coverage if it's not already been called. Note, private and 'trustme' identifiers will be skipped. Returns a list of covered routines, will implicitly call coverage if it's not previously been called. As with \*(C`naked\*(C', private and 'trustme' identifiers will be skipped.

Debugging support

In order to allow internals debugging, while allowing the optimiser to do its thang, \*(C`Pod::Coverage\*(C' uses constant subs to define how it traces.

Use them like so

sub Pod::Coverage::TRACE_ALL () { 1 } use Pod::Coverage;

Supported constants are:

\s-1TRACE_ALL\s0

Trace everything. Well that's all there is so far, are you glad you came?

Inheritance interface

These abstract methods while functional in \*(C`Pod::Coverage\*(C' may make your life easier if you want to extend \*(C`Pod::Coverage\*(C' to fit your house style more closely.

\s-1NOTE\s0 Please consider this interface as in a state of flux until this comment goes away. Return the \s-1GV\s0 for the coderef supplied. Used by \*(C`_get_syms\*(C' to identify locally defined code. You probably won't need to override this one. return a list of symbols to check for from the specified packahe

_get_pods

Extract pod markers from the currently active package. Return an arrayref or undef on fail.

_private_check($symbol)

return true if the symbol should be considered private

_trustme_check($symbol)

return true if the symbol is a 'trustme' symbol

BUGS

Due to the method used to identify documented subroutines \*(C`Pod::Coverage\*(C' may completely miss your house style and declare your code undocumented. Patches and/or failing tests welcome.

TODO

Widen the rules for identifying documentation

RELATED TO Pod::Coverage…

Test::More, Devel::Cover

AUTHORS

Richard Clamp <[email protected]>

Michael Stevens <[email protected]>

some contributions from David Cantrell <[email protected]>

COPYRIGHT

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.