Devel-Cover

 view release on metacpan or  search on metacpan

lib/Devel/Cover/Report/Html_basic.pm  view on Meta::CPAN

    showing => [ grep $options->{show}{$_}, $db->criteria ],
    headers => [
      map  { ($db->criteria_short)[$_] }
      grep { $options->{show}{ ($db->criteria)[$_] } }
        (0 .. $db->criteria - 1)
    ],
    annotations => [
      map { my $a = $_; map $a->header($_), 0 .. $a->count - 1 }
        @{ $options->{annotations} }
    ],
    filenames => {
      map { $_ => do { (my $f = $_) =~ s/\W/-/g; $f } } @{ $options->{file} }
    },
    exists      => { map { $_ => -e } @{ $options->{file} } },
    get_summary => \&get_summary,
    c0          => $le->($options->{report_c0}),
    c1          => $le->($options->{report_c1}),
    c2          => $le->($options->{report_c2}),
    c3          => $ge->($options->{report_c2}),
  );

  write_file $R{options}{outputdir}, "all";

  for (@{ $options->{file} }) {
    $R{file}      = $_;
    $R{file_link} = "$R{filenames}{$_}.html";
    $R{file_html} = "$options->{outputdir}/$R{file_link}";
    my $show = $options->{show};
    print_file;
    print_branches    if $show->{branch};
    print_conditions  if $show->{condition};
    print_subroutines if $show->{subroutine} || $show->{pod};
  }

  my $html = print_summary;
  print "HTML output written to $html\n" unless $options->{silent};
}

1;

package Devel::Cover::Report::Html_basic::Template::Provider;

use strict;
use warnings;

our $VERSION = '1.52'; # VERSION

use base "Template::Provider";

my %Templates;

sub fetch {
  my $self = shift;
  my ($name) = @_;
  # print "Looking for <$name>\n";
  $self->SUPER::fetch(exists $Templates{$name} ? \$Templates{$name} : $name)
}

$Templates{html} = <<'EOT';
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<!--
This file was generated by Devel::Cover Version [% R.version %]
Devel::Cover is copyright 2001-2026, Paul Johnson (paul@pjcj.net)
Devel::Cover is free. It is licensed under the same terms as Perl itself.
The latest version of Devel::Cover should be available from my homepage:
https://pjcj.net
-->
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
    <meta http-equiv="Content-Language" content="en-us"></meta>
    <link rel="stylesheet" type="text/css" href="cover.css"></link>
    <script type="text/javascript" src="common.js"></script>
    <script type="text/javascript" src="css.js"></script>
    <script type="text/javascript" src="standardista-table-sorting.js"></script>
    <title> [% title || "Coverage Summary" %] </title>
</head>
<body>
    [% content %]
</body>
</html>
EOT

$Templates{header} = <<'EOT';
<table>
    <tr>
        <th colspan="4">[% R.file %]</th>
    </tr>
    <tr class="hblank"><td class="dblank"></td></tr>
    <tr>
        <th class="hh">Criterion</th>
        <th class="hh">Covered</th>
        <th class="hh">Total</th>
        <th class="hh">%</th>
    </tr>
    [% FOREACH criterion = criteria %]
        [% vals = R.get_summary(R.file, criterion) %]
        <tr>
            <td class="h">[% criterion %]</td>
            <td>[% vals.covered %]</td>
            <td>[% vals.total %]</td>
            <td [% IF vals.class %]class="[% vals.class %]" [% END %]title="[% vals.details %]">
                [% IF vals.link.defined %]
                    <a href="[% vals.link %]"> [% vals.pc %] </a>
                [% ELSE %]
                    [% vals.pc %]
                [% END %]
            </td>
        </tr>
    [% END %]
</table>
<div><br></br></div>
EOT

$Templates{summary} = <<'EOT';
[% WRAPPER html %]

<h1> Coverage Summary </h1>
<table>



( run in 1.763 second using v1.01-cache-2.11-cpan-39bf76dae61 )