On Tue, Apr 18, 2017 at 12:32:57PM -0400, Jason Pyeron wrote:
> I am "require"ing a file but Devel::Cover is not logging the statements, only 
> the sub, use, and eval portions.
> 
> I tried a do(filename.pl) to no help.
> 
> I tried adding -subs_only off (and on) to no effect.
> 
> Any suggestions?

The problem here is the require or do.  After running the top-level
statements, perl throws them away, which means that by the time
Devel::Cover comes to match up the data it has recorded against the ops
in the program it can't find the ops for those top-level statements.

I had originally thought it would be quite easy to persuade perl not to
throw away such statements, but it has proven beyond my abilities so
far.

The toolchain summit is coming up shortly and I may see if I can't
impose on one of the clever folk who will be attending for a little
assistance.

So, my only practical suggestion, I'm afraid, is to bundle all the
top-level statements into a subroutine (which, as an old C programmer I
tend to call "main") and then call that subroutine as the only top-level
statement.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net

Reply via email to