App-ArchiveDevelCover

 view release on metacpan or  search on metacpan

lib/App/ArchiveDevelCover.pm  view on Meta::CPAN

        }
        $line.="</tr>";
        push(@output,$line);
    }
    my $table = join("\n",@output);
    my $tpl = $self->_diff_template;
    $tpl=~s/DATA/$table/;

    my $fh = $self->diff_html->openw;
    print $fh $tpl;
    close $fh;
}

sub td_style {
    my ($self, $val, $display) = @_;
    $display //=$val;
    my $style;
    given ($val) {
        when ($_ <  75) { $style = 'c0' }
        when ($_ <  90) { $style = 'c1' }
        when ($_ <  100) { $style = 'c2' }
        when ($_ >= 100) { $style = 'c3' }
    }
    return qq{<td class="$style">$display</td>};
}

sub _archive_template {
    my $self = shift;
    my $name = $self->project;
    $self->_page_template(
        "Test Coverage Archive for $name",
        q{
<table>
<tr><th>Coverage Report</th><th>diff</th><th>stmt</th><th>sub</th><th>total</th><th>Trend</th></tr>
<!-- INSERT -->
</table>
        });
}

sub _diff_template {
    my $self = shift;
    my $name = $self->project;
    $self->_page_template(
        "Test Coverage Diff for $name",
        q{
<table>
<tr><th>File</th><th>stmt</th><th>sub</th><th>total</th></tr>
DATA
</table>
        });
}

sub _page_template {
    my ($self, $title, $content) = @_;

    my $name = $self->project;
    my $class = ref($self);
    my $version = $class->VERSION;
    return <<"EOTMPL";
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- This file was generated by $class version $version -->
<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>
    <title>Test Coverage Archive for $name</title>
</head>
<body>

<body>
<h1>$title</h1>

$content

<p>Generated by <a href="http://metacpan.org/module/$class">$class</a> version $version.</p>

</body>
</html>
EOTMPL

}

__PACKAGE__->meta->make_immutable;
1;

__END__

=pod

=encoding UTF-8

=head1 NAME

App::ArchiveDevelCover - Archive Devel::Cover reports

=head1 VERSION

version 1.004

=head1 SYNOPSIS

Backend for the C<archive_devel_cover.pl> command. See L<archive_devel_cover.pl> and/or C<perldoc archive_devel_cover.pl> for details.

=head1 AUTHOR

Thomas Klausner <domm@plix.at>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2012 - 2022 by Thomas Klausner.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut



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