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.