File Coverage

blib/lib/SyForm/ViewRole/HTML.pm
Criterion Covered Total %
statement 20 20 100.0
branch 5 6 83.3
condition n/a
subroutine 8 8 100.0
pod n/a
total 33 34 97.0


line stmt bran cond sub pod time code
1             package SyForm::ViewRole::HTML;
2             BEGIN {
3 6     6   3422 $SyForm::ViewRole::HTML::AUTHORITY = 'cpan:GETTY';
4             }
5             # ABSTRACT: HTML view functions
6             $SyForm::ViewRole::HTML::VERSION = '0.103';
7 6     6   49 use Moo::Role;
  6         66  
  6         47  
8 6     6   4061 use SyForm::FormHTML;
  6         29  
  6         350  
9              
10 6     6   65 use overload '""' => sub { $_[0]->html };
  6     4   10  
  6         61  
  4         1359  
11              
12             has html => (
13             is => 'lazy',
14             );
15              
16             sub _build_html {
17 3     3   329 my ( $self ) = @_;
18 3         49 return $self->html_declare->as_html;
19             }
20              
21             has html_declare => (
22             is => 'lazy',
23             );
24              
25             sub _build_html_declare {
26 3     3   27 my ( $self ) = @_;
27 3         48 return $self->syform_formhtml->html_declare;
28             }
29              
30             has syform_formhtml => (
31             is => 'lazy',
32             );
33              
34             sub _build_syform_formhtml {
35 3     3   27 my ( $self ) = @_;
36             return SyForm::FormHTML->new(
37             children => [
38             map {
39             $_->has_syform_formhtml_children ? (
40 13 50       5917 @{$_->syform_formhtml_children}
  13         264  
41             ) : (),
42             } $self->fields->Values
43             ],
44             no_submit => $self->syform->no_html_submit,
45             $self->syform->has_html_submit ? (
46             submit_attributes => $self->syform->html_submit,
47             ) : (),
48 3 100       46 $self->syform->has_html ? ( %{$self->syform->html} ) : ()
  1 100       247  
49             );
50             }
51              
52             1;
53              
54             __END__
55              
56             =pod
57              
58             =head1 NAME
59              
60             SyForm::ViewRole::HTML - HTML view functions
61              
62             =head1 VERSION
63              
64             version 0.103
65              
66             =head1 AUTHOR
67              
68             Torsten Raudssus <torsten@raudss.us>
69              
70             =head1 COPYRIGHT AND LICENSE
71              
72             This software is copyright (c) 2014 by Torsten Raudssus.
73              
74             This is free software; you can redistribute it and/or modify it under
75             the same terms as the Perl 5 programming language system itself.
76              
77             =cut