I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2005-10-31 12:23:15-08 by stf
Filtering subroutine stats

I've started using Devel::Cover (excellent module!) to analyze my test suite. One thing I'm finding is that in the subroutine coverage analysis in most of my modules BEGIN gets included several times. I have some modules reporting 50% coverage testing when in actuality none of the functions are being run. It's just hitting BEGIN 3 times, none of the 3 functions, and reporting 50%. While I'm sure this is technically accurate, it's inflating my numbers and making the tests look better than they should. (I'm trying to make the case that we need to do more testing, so I don't want this. :-)

Two questions:

1. Why is BEGIN appearing numerous times? Because I'm using the module in several different places? Is there something with my code that I can do to mitigate having it show up so many times in the coverage analysis?

2. Is there any workaround I can use to filter BEGIN out entirely while I work on testing the remaining code? I have very few BEGIN blocks of interest and while I'd probably restore them to the list later, I don't want them there now.

Thanks for the module and any help you can provide.

Steve

Direct Responses: 1272 | Write a response
Posted on 2005-10-31 17:17:58-08 by stf in response to 1269
Re: Filtering subroutine stats

I've found more information about what's happening here. On every line where I use an external module, I get a report on that module's BEGIN block. This happens for the 'use strict' I have at the beginning of each module, as well as several other modules which I've excluded from the report (and those do not appear in the main report listing).

Is this normal behavior? If not, can anyone help me explain why it might be happening, or more importantly how to make it not happen?

BTW, I'm using Devel::Cover 0.55 and Perl 5.8.5 on Solaris 8.

Thanks again, Steve

Direct Responses: Write a response