jbert has asked for the wisdom of the Perl Monks concerning the following question:

Hi there. I'm using the (excellent) Devel::Cover module to see how much of an existing codebase I am exercising with some testing.

I'm actually interested in exercising all calls to a particular subroutine. This information might already be present in Devel::Cover somewhere (since it can provide a line-by-line breakdown), but what I really want is a tool which reads a Devel::Cover database and tells me how many of the call sites of sub X have been covered and is able to list the ones which have not.

Has anyone seen anything which can do this? Does anyone know enough about the internals of Devel::Cover already to give me an impression about whether it would be possible/reasonable for me to dig in and add the functionality?

Or am I missing a big piece of what I need, namely the ability to go from perl file&line (source code info) to parsed syntax tree (all callers of sub X)?

(One way it seems would work is to statically analyse the codebase to get file&line of all call sites and then somehow parse the Devel::Cover reports to see if those are covered, but that involves trying to recover information from the human-readable reporting format - surely there is a better way?)

Replies are listed 'Best First'.
Re: Coverage queries
by Khen1950fx (Canon) on Oct 27, 2006 at 10:26 UTC
      Thanks very much, that's an interesting paper.

      Sadly, as far as I can see, it doesn't really get into the problem I'm trying to solve. Although it does describe how the current module goes about its work (custom run-core notes which ops are executed and then uses the B:: modules to go from that to source lines).

      I guess it might be possible to intervene at that step, where we still have the op info, and note if we are invoking that particular sub, but I don't currently see a way of noting all the call sites of a particular function (other than 'grep' or similar).

      The Devel::Cover module is beatifully written though. Really clear code.