[dancer-users] How do you measure code coverage?

Иван Бессарабов ivan at bessarabov.ru
Tue Feb 4 17:12:07 GMT 2014


OMG. Great hack =)

David, thank you very much!

I'm not sure that I will implement this solution, because I don't
understand all the magic behind the code that should do the trick.
Hope it will be solved in Devel::Cover and I will be able just to use
`cover` without understanding all the secrets behind it.

On Fri, Jan 31, 2014 at 6:00 PM, David Cantrell <david at cantrell.org.uk> wrote:
> On Fri, Jan 31, 2014 at 10:15:17AM +0400, ???????? ???????????????????? wrote:
>
>> Devel::Cover does not create any metrics for such code:
>>
>>     any ['get', 'post'] => '/login' => sub {
>>     ...
>>     }
>>
>> So my question is how do you measure coverage of code that is tested?
>
> This is a known bug/mis-feature in Devel::Cover:
>
> https://github.com/pjcj/Devel--Cover/issues/51
>
> In our Dancer app at work I have some spectacularly evil code that works
> around it. In a module that our coverage checking script loads before
> anything else, it stuffs a sub-ref into @INC. That sub-ref intercepts
> any attempt to load the files in which our Dancer routes are defined,
> and wraps them in:
>
> package TheModuleWhoseBrainsWeAreCorrupting;
> sub main {
> # our victim's body goes here
> }main();
>
> Yes, it's effectively a source filter. Yes, it uses regexes to parse
> perl. Yes, that's why I'm not showing you the code. It's evil, and if
> you're going to do horrible things like that you should write it
> yourself so that you understand what's going on.
>
> --
> David Cantrell | top google result for "topless karaoke murders"
>
>   On the bright side, if sendmail is tied up routing spam and pointless
>   uknot posts, it's not waving its arse around saying "root me!"
>       -- Peter Corlett, in uknot
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users


More information about the dancer-users mailing list