eg/html_table.pl

filter: Statementstmt 100% 11 / 11 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 14 / 14 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« eg/from_file.pl ↑ Summary eg/json_output.pl »
1 #!/usr/bin/env perl
2 1 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Text::Stencil;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 my $s = Text::Stencil->new(
7 header => '<table><tr><th>ID</th><th>Name</th><th>Score</th></tr>',
8 row => '<tr><td>{0:int}</td><td>{1:html}</td><td>{2:float:1}</td></tr>',
9 footer => '</table>',
10 separator => "\n",
11 );
12  
13 1 my @rows = (
14 [1, 'Alice & Bob', 95.5],
15 [2, '<script>Eve</script>', 87.3],
16 [3, 'Charlie "C"', 92.1],
17 );
18  
19 1 say $s->render(\@rows);
« eg/from_file.pl ↑ Summary eg/json_output.pl »