1use strict; 2 3package HTML::FormFu::Role::Element::NonBlock; 4$HTML::FormFu::Role::Element::NonBlock::VERSION = '2.07'; 5# ABSTRACT: base class for single-tag elements 6 7use Moose::Role; 8 9use HTML::FormFu::Util qw( process_attrs ); 10 11has tag => ( is => 'rw', traits => ['Chained'] ); 12 13after BUILD => sub { 14 my $self = shift; 15 16 $self->filename('non_block'); 17 18 return; 19}; 20 21around render_data_non_recursive => sub { 22 my ( $orig, $self, $args ) = @_; 23 24 my $render = $self->$orig( 25 { tag => $self->tag, 26 $args ? %$args : (), 27 } ); 28 29 return $render; 30}; 31 32sub string { 33 my ( $self, $args ) = @_; 34 35 $args ||= {}; 36 37 my $render 38 = exists $args->{render_data} 39 ? $args->{render_data} 40 : $self->render_data; 41 42 # non_block template 43 44 my $html = sprintf "<%s%s />", 45 $render->{tag}, 46 process_attrs( $render->{attributes} ), 47 ; 48 49 return $html; 50} 51 521; 53 54__END__ 55 56=pod 57 58=encoding UTF-8 59 60=head1 NAME 61 62HTML::FormFu::Role::Element::NonBlock - base class for single-tag elements 63 64=head1 VERSION 65 66version 2.07 67 68=head1 DESCRIPTION 69 70Base class for single-tag elements. 71 72=head1 METHODS 73 74=head2 tag 75 76=head1 SEE ALSO 77 78Is a sub-class of, and inherits methods from L<HTML::FormFu::Element> 79 80L<HTML::FormFu> 81 82=head1 AUTHOR 83 84Carl Franks, C<cfranks@cpan.org> 85 86=head1 LICENSE 87 88This library is free software, you can redistribute it and/or modify it under 89the same terms as Perl itself. 90 91=head1 AUTHOR 92 93Carl Franks <cpan@fireartist.com> 94 95=head1 COPYRIGHT AND LICENSE 96 97This software is copyright (c) 2018 by Carl Franks. 98 99This is free software; you can redistribute it and/or modify it under 100the same terms as the Perl 5 programming language system itself. 101 102=cut 103