Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Does Pod::Coverage::Moose work or am I just being obtuse?

by Your Mother (Chancellor)
on Feb 22, 2010 at 19:36 UTC ( #824690=perlquestion: print w/ replies, xml ) Need Help??
Your Mother has asked for the wisdom of the Perl Monks concerning the following question:

Pod::Coverage::Moose (0.02). Why The Following-

Test file

use strict; use warnings; use Test::Pod::Coverage; use Test::More "no_plan"; pod_coverage_ok( "IsMoose", { coverage_class => "Pod::Coverage::Moose" } );

IsMoose package file

package IsMoose; use Moose; has [qw( moo cow )] => is => "rw", isa => "Str" ; 1; # (Update, added.) =pod =cut

Test output

> prove test-moose-pod.t -v test-moose-pod.t .. ok 1 - Pod coverage on IsMoose 1..1 ok All tests successful. Files=1, Tests=1, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.21 cusr + 0.01 csys = 0.24 CPU) Result: PASS

Why isn't that failing? moo and cow are uncovered. This is a boiled down example. I tried several other permutations and my real code with Moose attribute methods and Roles and such are also passing as if it were being tested with plain Test::Pod::Coverage; e.g., only sub named {} are being checked at all.

Do I misunderstand what this does? Am I suffering from PEBCAK?

Comment on Does Pod::Coverage::Moose work or am I just being obtuse?
Select or Download Code
Re: Does Pod::Coverage::Moose work or am I just being obtuse?
by Khen1950fx (Canon) on Feb 23, 2010 at 13:21 UTC
    I ran the tests, and they passed. I ran this script to see if it was working or not. I tested it with all the handles. The only one that really didn't work was why_unrated.
    #!/usr/bin/perl use strict; use warnings; use Pod::Coverage::Moose; my @mods = ( 'Moose', 'Pod::Coverage::Moose', 'Moose::Test', 'MooseX::Types', 'Moose::Micro', 'MooseX::Method' ); foreach my $mod (@mods) { my $pcm = Pod::Coverage::Moose->new( package => $mod ); print 'Coverage: ', $pcm->coverage, "\n"; }

      Thanks but even stripping it down to not running through Test::Pod::Coverage is still not behaving as I'd expect from the docs. This is the plain PCM behavior-

      perl -MPod::Coverage::Moose -le '$pcm = Pod::Coverage::Moose->new(pack +age => "IsMoose"); print $pcm->uncovered' # Prints nothing...

      I expect it to show moo and cow both as uncovered. :( I really like the idea of this module and I'd love to be able to get it to give "real" feedback about Moose attributes/methods.

        I been experimenting with this all day. What has been happening, for me at least, is that I've been adding things that I knew were covered then I'd call $pcm->covered. The module prints out all the methods that are covered and returns 1. On the other hand, when I call $pcm->uncovered on the things I knew to be uncovered, the module returned undef---it didn't print. I was expecting it to return the uncovered handles. The joys of "PEBKAC hell":).
Re: Does Pod::Coverage::Moose work or am I just being obtuse?
by webfiend (Vicar) on Aug 06, 2010 at 22:15 UTC

    The default behavior of Pod::Coverage when deciding what to look for (in _get_syms) is to ignore imported subroutines such as those generated for Moose attributes. So even though it sees the methods associated with the attributes, it drops them.

    Maybe Pod::Coverage could use a 'watchlist' argument for its constructor to explicitly specify methods that need pod entries even if they're imported from elsewhere. Then Pod::Coverage::Moose might be able to take advantage of that, sifting through class attributes to build an appropriate watch list based on those defined in the class rather than big meta-stuff like 'blessed' or 'confess'. 'IsMoose::cow'? On the watch list. 'IsMoose::meta'? Not on the watch list.

    The basic problem was reported as a regression a while back.

    I'll have to chew on this thought a little bit.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://824690]
Approved by toolic
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2015-07-02 04:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (27 votes), past polls