NAME Plack::App::Tags::HTML - Plack application for running Tags::HTML objects. SYNOPSIS use Plack::App::Tags::HTML; my $obj = Plack::App::Tags::HTML->new(%parameters); my $app = $obj->to_app; METHODS Class inherites Plack::Component::Tags::HTML. "new" my $obj = Plack::App::Tags::HTML->new(%parameters); Constructor. Returns instance of object. * "component" Tags::HTML component. Option is required. * "constructor_args" Tags::HTML component constructor arguments. Default value is undef. * "data" Array data structure as input argument of Tags::HTML::process(). Default value is undef. * "data_css" Reference to array with structure for input argument of Tags::HTML::process_css(). Default value is undef. * "data_init" Reference to array with structure for input argument of Tags::HTML::init(). This structure is used in init phase of each web app call. Default value is undef. * "data_prepare" Reference to array with structure for input argument of Tags::HTML::init(). This structure is used in init phase of preparation of web app. Default value is undef. "to_app" my $app = $obj->to_app; Get code of plack application. Returns code of app. ERRORS prepare_app(): Cannot load component '%s'. Error: %s Component must be a instance of 'Tags::HTML' class. EXAMPLE1 use strict; use warnings; use Plack::App::Tags::HTML; use Plack::Runner; # Run application. my $app = Plack::App::Tags::HTML->new( 'component' => 'Tags::HTML::Stars', 'data' => [{ 1 => 'full', 2 => 'half', 3 => 'nothing', }], )->to_app; Plack::Runner->new->run($app); # Output: # HTTP::Server::PSGI: Accepting connections at http://0:5000/ # > curl http://localhost:5000/ # #
EXAMPLE2 use strict; use warnings; package App; use base qw(Tags::HTML); sub _process { my ($self, $value_hr) = @_; $self->{'tags'}->put( ['b', 'div'], ['a', 'class', 'my-class'], ['d', join ',', @{$value_hr->{'foo'}}], ['e', 'div'], ); return; } sub _process_css { my $self = shift; $self->{'css'}->put( ['s', '.my-class'], ['d', 'border', '1px solid black'], ['e'], ); return; } package main; use Plack::App::Tags::HTML; use Plack::Runner; # Run application. my $app = Plack::App::Tags::HTML->new( 'component' => 'App', 'data' => [{ 'foo' => [1, 2], }], )->to_app; Plack::Runner->new->run($app); # Output: # HTTP::Server::PSGI: Accepting connections at http://0:5000/ # > curl http://localhost:5000/ # #
1,2
DEPENDENCIES English, Error::Pure, Plack::Component::Tags::HTML, Plack::Util::Accessor, Symbol::Get. SEE ALSO Tags::HTML Tags helper abstract class. REPOSITORY AUTHOR Michal Josef Špaček LICENSE AND COPYRIGHT © 2021-2023 Michal Josef Špaček BSD 2-Clause License VERSION 0.14