Skip Menu |

This queue is for tickets about the MooX-TypeTiny CPAN distribution.

Report information
The Basics
Id: 133871
Status: rejected
Priority: 0/
Queue: MooX-TypeTiny

People
Owner: Nobody in particular
Requestors: ether [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Method from composed class is seen as a function by Devel::Symdump
I noticed a particular module is failing its pod coverage test -- the "uncovered" function is actually defined in a role being composed. It doesn't matter if the method is actually mentioned at all in the class. Removing "use MooX::TypeTiny" made the problem go away. Internally, Pod::Coverage is using Devel::Symdump->new($package)->functions to get the list of coverage candidates: https://metacpan.org/release/Pod-Coverage/source/lib/Pod/Coverage.pm#L303-336 Moo: 2.004003 MooX::TypeTiny: 0.002003 perl: 5.033004 Below is a stripped-down version of the code that demonstrates the issue (the uncovered sub name is "evaluator"): --- use strict; use warnings; package JSON::Schema::Draft201909::Vocabulary::Format; use Moo; use MooX::TypeTiny 0.002002; with 'JSON::Schema::Draft201909::Vocabulary'; sub vocabulary {} sub keywords {} 1; __END__ =pod =cut ---
Explanation from IRC: <haarg> that's probably a wontfix <ether> ah bummer, I was hoping it would be something obvious <ether> Test::CleanNamespaces doesn't have a problem with the sub; I couldn't see why Devel::Symdump would <ether> s/obvious/simple/ <haarg> MooX::TypeTiny applies roles to the accessor generators for the class or role <haarg> if the accessor generator is different between the role and the class it is applied to, the accessors get regenerated rather than copied from the role <haarg> so without MooX::TypeTiny, it just copies the method from the role. Devel::Symdump sees it as imported, so Pod::Coverage doesn't make you cover it. <haarg> with MooX::TypeTiny, it generates the method in the class. Devel::Symdump sees it as part of the class, so Pod::Coverage wants it to be covered. <haarg> in a sense, the behavior with MooX::TypeTiny is more accurate <haarg> Test::CleanNamespaces is fine with the behavior when it generates in the class, because that's just like a normal accessor or method <haarg> and when it copies it from the role, Test::CleanNamespaces checks if the origin package is a role and ignores it <ether> what requires the accessor generator to be different between the role and the class? <haarg> that's how MooX::TypeTiny works <haarg> it changes the accessor generator <haarg> if JSON::Schema::Draft201909::Vocabulary used MooX::TypeTiny, it would be the same for both and would get copied <haarg> i'd expect if you were using Moose it would always have this problem <haarg> because roles don't get accessors <haarg> need something like Pod::Coverage::CountParents that works for roles