Доброго всем

Mojolicious::Plugin::RenderCGI

¡ ¡ ¡ ALL GLORY TO GLORIA ! ! !

VERSION

0.001

NAME

Mojolicious::Plugin::RenderCGI - Rendering template with Perl code and CGI.pm subs imports.

SYNOPSIS

 $app->plugin('RenderCGI');
 
 # Set as default handler
 $app->renderer->default_handler('cgi');
 # or same
 $app->defaults(handler=>'cgi');

 # Render without setting as default handler
 $c->render(handler => 'cgi');
 

Template

File name like "templates/foo/bar.html.cgi"

# $c and $self already are controller
# $cgi is a CGI object (OO-style)

$c->layout('default', handler=>'ep',);# set handler 'ep' for all includes !!!
my $foo = $c->stash('foo')
  or die "Where is your FOO?";
#=======================================
#======= content comma list! ===========
#=======================================
$c->include('far', handler=>'cgi'),# change handler against layout
$c->include('bax'); # handler still "cgi" unless template "bax" (and its includes) didn`t changed it
h1({}, "Welcome"),
<<END_HTML,
<input id="bah" name="bah" type="checkbox" />
<label for="bah">$foo</label>
END_HTML
$self->app->log->info("Template has done")
  && undef,

There are NO Mojolicious helpers without OO-style: $c-\> OR b<$self-\>> prefix.

Options

import (string (space delims) | arrayref)

What subs do you want from CGI.pm import

$app->plugin('RenderCGI', import=>':html -any');
# or 
$app->plugin('RenderCGI', import=>[qw(:html -any)]);

See at perldoc CGI.pm section "USING THE FUNCTION-ORIENTED INTERFACE". Default is ':html :form' (string) same as [qw(:html :form)] (arrayref).

import=>[], # none import, CGI OO-style only

skip_fatals (bool)

Show fatal errors (not found, compile and runtime errors) as content of there template. By default on development mode set to 0 and 1 on production. Works on cgi handler only.

skip_fatals=>1, 

Methods, subs, helpers...

Implements register method only. Register new renderer handler 'cgi'. No new helpers.

SEE ALSO

CGI

Mojolicious::Plugin::TagHelpers

HTML::Tiny

AUTHOR

Михаил Че (Mikhail Che), <mche[-at-]cpan.org>

BUGS / CONTRIBUTING

Please report any bugs or feature requests at https://github.com/mche/Mojolicious-Plugin-RenderCGI/issues. Pull requests also welcome.

COPYRIGHT

Copyright 2016 Mikhail Che.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.