blib/lib/HTML/Shakan/Renderer/HTML.pm

filter: Statementstmt 100% 26 / 26 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 94.5% 35 / 37 CC 4 SCAR 8.5
CC
4
Cov
97%
render
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.3
« blib/lib/HTML/Shakan/Filters.pm ↑ Summary blib/lib/HTML/Shakan/Role/Model.pm »
1 package HTML::Shakan::Renderer::HTML;
2 22 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 22 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 22 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 22 ▶use HTML::Escape ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 22 has 'id_tmpl' => (
8 is => 'ro',
9 isa => 'Str',
10 default => 'id_%s',
11 );
12  
13 sub render {
14 9 ▶ my ($self, $form) = @_;
Subroutine render: called CC=4 SCAR=13.9
Pod undocumented
15  
16 9 my @res;
17 9 for my $field ($form->fields) {
18 11 ▶ unless ($field->id) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($field->id) 9 2 11
19 9 $field->id(sprintf($self->id_tmpl(), $field->{name}));
20 }
21 11 ▶ if ($field->label) {
Branch: 1 branch
BranchTrueFalseTotal
if ($field->label) 11 0 11
22 push @res, sprintf( q{<label for="%s">%s</label>},
23 11 $field->{id}, HTML::Escape::escape_html( $field->{label} ) );
24 }
25 11 push @res, $form->widgets->render( $form, $field );
26 }
27 9 join '', @res;
28 }
29  
30 22 ▶no Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 22 __PACKAGE__->meta->make_immutable;
32 __END__
33  
34 =head1 DESCRIPTION
35  
36 simple HTML renderer for HTML::Shakan.
« blib/lib/HTML/Shakan/Filters.pm ↑ Summary blib/lib/HTML/Shakan/Role/Model.pm »