5 prg. seems to be broken by Devel::Cover 0.59
9 The coverage analysis of CPAN.pm is difficult to read because the
10 methods do not contain the package name.
12 Solution 1 would be to split the file, but I really like these things
13 kept in one editor window.
15 Solution 2 would be to find the option in "cover" that writes the HTML
16 and if it's not there, add it.
18 Solution 3 is to post-process the HTML. By far the simplest for me,
19 even if it's the ugliest.
26 my $html = shift or die "Usage: $0 file-to-process";
28 my($hdir,$ppath,$type) = $html =~ m
|(.+)/([^/]+)--(\w
+)\
.html
$|;
29 $ppath =~ s/-pm$/.pm/ or die;
33 open my $pfh, $ppath or die;
38 $curpkg = $1 if /^\s*package\s+([\w:]+)/;
41 my $line = $. + $delta;
42 $line_sub_pkg{"$line\:$1"} = $curpkg;
49 open my $rhfh, $html or die "Could not open $html\: $!";
50 open my $whfh, ">", "$html.new" or die;
52 if (m
|^(<tr
>.*<div
class="s">)(\w
+)(</div></td
></tr
>)|) {
53 my($hpre,$subr,$hpost) = ($1,$2,$3);
54 my($line) = $hpre =~ /id="L(\d+)"/;
55 if (my $pkg = $line_sub_pkg{"$line:$subr"}) {
56 print $whfh "$hpre$pkg\::$subr$hpost\n";
66 rename $html, "$html.old" or die;
67 rename "$html.new", $html or die;