Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cevel::Cover missing lines?

5 views
Skip to first unread message

Jason Pyeron

unread,
Apr 18, 2017, 1:00:04 PM4/18/17
to per...@perl.org
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?

(source can be found at https://sourceforge.net/u/jpyeron/logwatch/ci/master/tree/)

-Jason
scripts-logwatch-pl.trim.html
tests-script-test-pl.html

Paul Johnson

unread,
Apr 18, 2017, 4:15:02 PM4/18/17
to Jason Pyeron, per...@perl.org
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 - pa...@pjcj.net
http://www.pjcj.net

Jason Pyeron

unread,
Apr 18, 2017, 7:15:02 PM4/18/17
to per...@perl.org
> -----Original Message-----
> From: Paul Johnson
> Sent: Tuesday, April 18, 2017 15:29
>
> 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.

That is sad.

>
> 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.

That would be awesome. How can I help?

>
> 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.

Changing the the code to support this is not an option.

-Jason
0 new messages