Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Devel-Cover CPAN distribution.

Report information
The Basics
Id: 39076
Status: open
Priority: 0/
Queue: Devel-Cover

People
Owner: Nobody in particular
Requestors: mschwern [...] cpan.org
Cc: jkeenan [...] cpan.org
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.64
Fixed in: (no value)



Subject: Contents of eval STRING counted against coverage
I noticed that my coverage reports would have many statements around an eval STRING like so: Run: /Users/schwern/tmp/bug.plx Perl version: 5.8.8 OS: darwin Start: Sun Sep 7 23:55:04 2008 Finish: Sun Sep 7 23:55:04 2008 bug.plx line err stmt bran cond sub pod time code 1 #!/usr/bin/perl -w 2 3 1 1 51 use strict; 1 4 1 8 4 1 1 7 use warnings; 1 2 1 23 5 6 1 9 my @codes = (q{ 7 use LWP; 8 1; 9 }, 10 q{ 11 use ARgle; 12 1; 13 }); 14 15 1 1 12 eval $_ for @codes; 1 1 3 1 516 1 3 1 14 1 6 *** 0 *** 0 You'll notice that it reports two "statements" as uncovered. This appears to happen if the eval STRING fails, as in the case of "use ARgle". This seems to be a bug, the coverage of an eval STRING should not include the eval'd code. There's no way to see what the code was in the report, and part of the point of an eval STRING is that the code might fail. It just looks bizarre.
On Sun Sep 07 20:02:42 2008, MSCHWERN wrote: Show quoted text
> I noticed that my coverage reports would have many statements around an > eval STRING like so: > > Run: /Users/schwern/tmp/bug.plx > Perl version: 5.8.8 > OS: darwin > Start: Sun Sep 7 23:55:04 2008 > Finish: Sun Sep 7 23:55:04 2008 > > bug.plx > > line err stmt bran cond sub pod time code > 1 #!/usr/bin/perl -w > 2 > 3 1 1 51 use strict; > 1 4 > 1 8 > 4 1 1 7 use warnings; > 1 2 > 1 23 > 5 > 6 1 9 my @codes = (q{ > 7 use LWP; > 8 1; > 9 }, > 10 q{ > 11 use ARgle; > 12 1; > 13 }); > 14 > 15 1 1 12 eval $_ for @codes; > 1 1 3 > 1 516 > 1 3 > 1 14 > 1 6 > *** 0 > *** 0 > > You'll notice that it reports two "statements" as uncovered. This > appears to happen if the eval STRING fails, as in the case of "use ARgle". > > This seems to be a bug, the coverage of an eval STRING should not > include the eval'd code. There's no way to see what the code was in the > report, and part of the point of an eval STRING is that the code might > fail. It just looks bizarre.
Reproduced with Perl 5.16.0 and Devel::Cover 1.00.