анатолий шарифулин Mojolicious
Transcript of анатолий шарифулин Mojolicious
![Page 1: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/1.jpg)
Mojolicious.Веб в коробке!
Анатолий Шарифулин
![Page 3: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/3.jpg)
Sebastian Riedelавтор Catalyst и Mojolicious
http://twitter.com/kraih
![Page 5: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/5.jpg)
Что такоеMojolicious?
![Page 6: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/6.jpg)
Что такое Mojolicious?• Pure Perl веб-фреймворк
• Без зависимостей (с версии Perl 5.8.1)
• Объектно-ориентированное API (без скрытой магии)
• Поддержка HTTP 1.1, WebSocket, IPv6, SSL, IDNA
• Поддержка CGI, FastCGI, PSGI, Daemon и Prefork
• Веб-фреймворки: Mojo, Mojolicious и Mojolicious::Lite
![Page 7: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/7.jpg)
«Fresh code,based upon years of expirience developing
Catalyst»
![Page 9: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/9.jpg)
Pure Perlвеб-фреймворк
![Page 10: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/10.jpg)
• Mojo::Base
• Mojo::ByteStream
• Mojo::Template, Mojo::JSON
• Mojo::Loader, Mojo::Log, Mojo::Path
• Mojo::URL, Mojo::Parameters, Mojo::Content
• Mojo::Message::Request, Mojo::Message::Response,Mojo::Headers, Mojo::Cookie, Mojo::Date
![Page 11: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/11.jpg)
• Mojo::Base
• Mojo::ByteStream
• Mojo::Template, Mojo::JSON
• Mojo::Loader, Mojo::Log, Mojo::Path
• Mojo::URL, Mojo::Parameters, Mojo::Content
• Mojo::Message::Request, Mojo::Message::Response,Mojo::Headers, Mojo::Cookie, Mojo::Date
![Page 12: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/12.jpg)
Mojo::BaseMinimal Base Class For Mojo Projects
![Page 13: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/13.jpg)
package App;use base ‘Mojo::Base’;
__PACKAGE__->attr(conf => sub { return do ‘conf/app.conf’;});__PACKAGE__->attr(db => sub { my $self = shift; return Util->db($self->conf->{'db'});});
sub dispatch { ... }
![Page 14: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/14.jpg)
package App;use base ‘Mojo::Base’;
__PACKAGE__->attr(conf => sub { return do ‘conf/app.conf’;});__PACKAGE__->attr(db => sub { my $self = shift; return Util->db($self->conf->{'db'});});
sub dispatch { ... }
![Page 15: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/15.jpg)
package App;use base ‘Mojo::Base’;
__PACKAGE__->attr(conf => sub { return do ‘conf/app.conf’;});__PACKAGE__->attr(db => sub { my $self = shift; return Util->db($self->conf->{'db'});});
sub dispatch { ... }
![Page 16: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/16.jpg)
• Mojo::Base
• Mojo::ByteStream
• Mojo::Template, Mojo::JSON
• Mojo::Loader, Mojo::Log, Mojo::Path
• Mojo::URL, Mojo::Parameters, Mojo::Content
• Mojo::Message::Request, Mojo::Message::Response,Mojo::Headers, Mojo::Cookie, Mojo::Date
![Page 17: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/17.jpg)
Mojo::ByteStreamByteStream
![Page 18: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/18.jpg)
use Mojo::ByteStream;my $s = Mojo::ByteStream->new('foo_bar');
$s->camelize; $s->decamelize;$s->b64_encode; $s->b64_decode;$s->encode('utf8'); $s->decode('utf8');$s->html_escape; $s->html_unescape;$s->qp_encode; $s->qp_decode;$s->quote; $stream->unquote;$s->url_escape; $s->url_unescape;$s->xml_escape;$s->punycode_encode; $s->punycode_decode;
![Page 19: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/19.jpg)
use Mojo::ByteStream 'b';my $s = b('foo_bar');
$s->camelize; $s->decamelize;$s->b64_encode; $s->b64_decode;$s->encode('utf8'); $s->decode('utf8');$s->html_escape; $s->html_unescape;$s->qp_encode; $s->qp_decode;$s->quote; $stream->unquote;$s->url_escape; $s->url_unescape;$s->xml_escape;$s->punycode_encode; $s->punycode_decode;
![Page 20: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/20.jpg)
use Mojo::ByteStream;my $s = Mojo::ByteStream->new('foo_bar');
$s->camelize; $s->decamelize;$s->b64_encode; $s->b64_decode;$s->encode('utf8'); $s->decode('utf8');$s->html_escape; $s->html_unescape;$s->qp_encode; $s->qp_decode;$s->quote; $stream->unquote;$s->url_escape; $s->url_unescape;$s->xml_escape;$s->punycode_encode; $s->punycode_decode;
![Page 21: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/21.jpg)
use Mojo::ByteStream;my $s = Mojo::ByteStream->new('foo_bar');
$s->camelize; $s->decamelize;$s->b64_encode; $s->b64_decode;$s->encode('utf8'); $s->decode('utf8');$s->html_escape; $s->html_unescape;$s->qp_encode; $s->qp_decode;$s->quote; $stream->unquote;$s->url_escape; $s->url_unescape;$s->xml_escape;$s->punycode_encode; $s->punycode_decode;
![Page 22: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/22.jpg)
use Mojo::ByteStream;my $s = Mojo::ByteStream->new('foo_bar');
$s->camelize; $s->decamelize;$s->b64_encode; $s->b64_decode;$s->encode('utf8'); $s->decode('utf8');$s->html_escape; $s->html_unescape;$s->qp_encode; $s->qp_decode;$s->quote; $stream->unquote;$s->url_escape; $s->url_unescape;$s->xml_escape;$s->punycode_encode; $s->punycode_decode;
![Page 23: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/23.jpg)
use Mojo::ByteStream;my $s = Mojo::ByteStream->new('foo_bar');
$s->camelize; $s->decamelize;$s->b64_encode; $s->b64_decode;$s->encode('utf8'); $s->decode('utf8');$s->html_escape; $s->html_unescape;$s->qp_encode; $s->qp_decode;$s->quote; $stream->unquote;$s->url_escape; $s->url_unescape;$s->xml_escape;$s->punycode_encode; $s->punycode_decode;
![Page 24: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/24.jpg)
use Mojo::ByteStream;my $s = Mojo::ByteStream->new('foo_bar');
$s->camelize; $s->decamelize;$s->b64_encode; $s->b64_decode;$s->encode('utf8'); $s->decode('utf8');$s->html_escape; $s->html_unescape;$s->qp_encode; $s->qp_decode;$s->quote; $stream->unquote;$s->url_escape; $s->url_unescape;$s->xml_escape;$s->punycode_encode; $s->punycode_decode;
![Page 25: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/25.jpg)
use Mojo::ByteStream;my $s = Mojo::ByteStream->new('foo_bar');
$s->camelize; $s->decamelize;$s->b64_encode; $s->b64_decode;$s->encode('utf8'); $s->decode('utf8');$s->html_escape; $s->html_unescape;$s->qp_encode; $s->qp_decode;$s->quote; $stream->unquote;$s->url_escape; $s->url_unescape;$s->xml_escape;$s->punycode_encode; $s->punycode_decode;
![Page 26: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/26.jpg)
use Mojo::ByteStream;my $s = Mojo::ByteStream->new('foo_bar');
$s->camelize; $s->decamelize;$s->b64_encode; $s->b64_decode;$s->encode('utf8'); $s->decode('utf8');$s->html_escape; $s->html_unescape;$s->qp_encode; $s->qp_decode;$s->quote; $stream->unquote;$s->url_escape; $s->url_unescape;$s->xml_escape;$s->punycode_encode; $s->punycode_decode;
![Page 27: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/27.jpg)
use Mojo::ByteStream;my $s = Mojo::ByteStream->new('foo_bar');
$s->camelize; $s->decamelize;$s->b64_encode; $s->b64_decode;$s->encode('utf8'); $s->decode('utf8');$s->html_escape; $s->html_unescape;$s->qp_encode; $s->qp_decode;$s->quote; $stream->unquote;$s->url_escape; $s->url_unescape;$s->xml_escape;$s->punycode_encode; $s->punycode_decode;
![Page 28: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/28.jpg)
use Mojo::ByteStream;my $s = Mojo::ByteStream->new('foo_bar');
$s->camelize; $s->decamelize;$s->b64_encode; $s->b64_decode;$s->encode('utf8'); $s->decode('utf8');$s->html_escape; $s->html_unescape;$s->qp_encode; $s->qp_decode;$s->quote; $stream->unquote;$s->url_escape; $s->url_unescape;$s->xml_escape;$s->punycode_encode; $s->punycode_decode;
![Page 29: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/29.jpg)
• Mojo::Base
• Mojo::ByteStream
• Mojo::Template, Mojo::JSON
• Mojo::Loader, Mojo::Log, Mojo::Path
• Mojo::URL, Mojo::Parameters, Mojo::Content
• Mojo::Message::Request, Mojo::Message::Response,Mojo::Headers, Mojo::Cookie, Mojo::Date
![Page 30: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/30.jpg)
Mojo::TemplatePerlish Templates!
![Page 31: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/31.jpg)
% my $list = $self->stash(‘list’);
<ul>% for (@$list) { <li> <%= $_->{title} %> </li>% }</ul>
<p><%# comment %></p>
![Page 32: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/32.jpg)
% my $list = $self->stash(‘list’);
<ul>% for (@$list) { <li> <%= $_->{title} %> </li>% }</ul>
<p><%# comment %></p>
![Page 33: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/33.jpg)
% my $list = $self->stash(‘list’);
<ul>% for (@$list) { <li> <%= $_->{title} %> </li>% }</ul>
<p><%# comment %></p>
![Page 34: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/34.jpg)
% my $count = 10 * 5;
<ul>% for (@$list) { <li> <%= $_->{title} %> </li>% }</ul>
<p><%# comment %></p>
![Page 35: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/35.jpg)
% use Foo::Bar;
<ul>% for (@$list) { <li> <%= $_->{title} %> </li>% }</ul>
<p><%# comment %></p>
![Page 36: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/36.jpg)
% my $list = $self->stash(‘list’);
<ul>% for (@$list) { <li> <%= $_->{title} %> </li>% }</ul>
<p><%# comment %></p>
![Page 37: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/37.jpg)
% my $list = $self->stash(‘list’);
<ul>% if (@$list) { <li> <%= $_->{title} %> </li>% }</ul>
<p><%# comment %></p>
![Page 38: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/38.jpg)
% my $list = $self->stash(‘list’);
<ul>% for (@$list) { <li> <%= $_->{title} %> </li>% }</ul>
<p><%# comment %></p>
![Page 39: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/39.jpg)
% my $list = $self->stash(‘list’);
<ul>% for (@$list) { <li> <%= $_->{title} %> </li>% }</ul>
<p><%# comment %></p>
![Page 40: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/40.jpg)
% my $list = $self->stash(‘list’);
<ul>% for (@$list) { <li> <%==$_->{title} %> </li>% }</ul>
<p><%# comment %></p>
![Page 41: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/41.jpg)
% my $list = $self->stash(‘list’);
<ul>% for (@$list) { <li> <%= uc $_->{title} %> </li>% }</ul>
<p><%# comment %></p>
![Page 42: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/42.jpg)
% my $list = $self->stash(‘list’);
<ul>% for (@$list) { <li> <%= $_->{title} %> </li>% }</ul>
<p><%# comment %></p>
![Page 43: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/43.jpg)
% my $list = $self->stash(‘list’);
<ul>% for (@$list) { <li> <%= $_->{title} %> </li>% }</ul>
<p><%# comment %></p>
![Page 44: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/44.jpg)
% my $list = $self->stash(‘list’);
<ul>% for (@$list) { <li> <%= $_->{title} xx %> </li>% }</ul>
<p><%# comment %></p>
1 2 3 4 5 6 7 8 91011
![Page 45: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/45.jpg)
Bareword "xx" not allowed while "strict subs" in use at template line 6.
Сообщение об ошибке
![Page 46: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/46.jpg)
Простота PHP, мощь Perl
![Page 47: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/47.jpg)
• Mojo::Base
• Mojo::ByteStream
• Mojo::Template, Mojo::JSON
• Mojo::Loader, Mojo::Log, Mojo::Path
• Mojo::URL, Mojo::Parameters, Mojo::Content
• Mojo::Message::Request, Mojo::Message::Response,Mojo::Headers, Mojo::Cookie, Mojo::Date
![Page 48: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/48.jpg)
Mojo::JSONMinimalistic JSON
![Page 49: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/49.jpg)
my $json = Mojo::JSON->new;
my $string = $json->encode({foo => ‘bar’});
my $hash = $json->decode(‘{"foo":"bar"}’);
![Page 50: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/50.jpg)
my $json = Mojo::JSON->new;
my $string = $json->encode({foo => ‘bar’});
my $hash = $json->decode(‘{"foo":"bar"}’);
![Page 51: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/51.jpg)
• Mojo::Base
• Mojo::ByteStream
• Mojo::Template, Mojo::JSON
• Mojo::Loader, Mojo::Log, Mojo::Path
• Mojo::URL, Mojo::Parameters, Mojo::Content
• Mojo::Message::Request, Mojo::Message::Response,Mojo::Headers, Mojo::Cookie, Mojo::Date
![Page 52: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/52.jpg)
Mojo::LoaderClass loader: load, reload, search
![Page 53: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/53.jpg)
• Mojo::Base
• Mojo::ByteStream
• Mojo::Template, Mojo::JSON
• Mojo::Loader, Mojo::Log, Mojo::Path
• Mojo::URL, Mojo::Parameters, Mojo::Content
• Mojo::Message::Request, Mojo::Message::Response,Mojo::Headers, Mojo::Cookie, Mojo::Date
![Page 54: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/54.jpg)
• Mojo::Base
• Mojo::ByteStream
• Mojo::Template, Mojo::JSON
• Mojo::Loader, Mojo::Log, Mojo::Path
• Mojo::URL, Mojo::Parameters, Mojo::Content
• Mojo::Message::Request, Mojo::Message::Response,Mojo::Headers, Mojo::Cookie, Mojo::Date
![Page 55: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/55.jpg)
• Mojo::Base
• Mojo::ByteStream
• Mojo::Template, Mojo::JSON
• Mojo::Loader, Mojo::Log, Mojo::Path
• Mojo::URL, Mojo::Parameters, Mojo::Content
• Mojo::Message::Request, Mojo::Message::Response,Mojo::Headers, Mojo::Cookie, Mojo::Date
![Page 56: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/56.jpg)
• Mojo::Trasaction
• Mojo::IOLoop
• Mojo::Client, Mojo::Server
• Mojo::Server::CGI, Mojo::Server::FastCGI
• Mojo::Server::PSGI
• Mojo::Server::Daemon и ::Prefork
• Mojo::Command
• Mojo::Command::Generate и ~ Server
![Page 57: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/57.jpg)
• Mojo::Trasaction
• Mojo::IOLoop
• Mojo::Client, Mojo::Server
• Mojo::Server::CGI, Mojo::Server::FastCGI
• Mojo::Server::PSGI
• Mojo::Server::Daemon и ::Prefork
• Mojo::Command
• Mojo::Command::Generate и ~ Server
![Page 58: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/58.jpg)
• Mojo::Trasaction
• Mojo::IOLoop
• Mojo::Client, Mojo::Server
• Mojo::Server::CGI, Mojo::Server::FastCGI
• Mojo::Server::PSGI
• Mojo::Server::Daemon и ::Prefork
• Mojo::Command
• Mojo::Command::Generate и ~ Server
![Page 59: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/59.jpg)
Mojo::IOLoopMinimalistic Reactor For TCP Clients And Servers
![Page 60: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/60.jpg)
Mojo::IOLoopПоддержка IO::KQueue, IO::Epoll,IO::Socket::INET6 и IO::Socket::SSL
![Page 61: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/61.jpg)
my $loop = Mojo::IOLoop->new;
$loop->listen(port => 3000, cb => sub { my ($self, $id) = @_; $self->read_cb ($id => sub { ... });
$self->write_cb($id => sub { ... }););
my $id = $loop->connect(port => 3000, ...);
$loop->start; $loop->stop;
![Page 62: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/62.jpg)
my $loop = Mojo::IOLoop->new;
$loop->listen(port => 3000, cb => sub { my ($self, $id) = @_; $self->read_cb ($id => sub { ... });
$self->write_cb($id => sub { ... }););
my $id = $loop->connect(port => 3000, ...);
$loop->start; $loop->stop;
![Page 63: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/63.jpg)
my $loop = Mojo::IOLoop->new;
$loop->listen(port => 3000, cb => sub { my ($self, $id) = @_; $self->read_cb ($id => sub { ... });
$self->write_cb($id => sub { ... }););
my $id = $loop->connect(port => 3000, ...);
$loop->start; $loop->stop;
![Page 64: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/64.jpg)
my $loop = Mojo::IOLoop->new;
$loop->listen(port => 3000, cb => sub { my ($self, $id) = @_; $self->read_cb ($id => sub { ... });
$self->write_cb($id => sub { ... }););
my $id = $loop->connect(port => 3000, ...);
$loop->start; $loop->stop;
![Page 65: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/65.jpg)
• Mojo::Trasaction
• Mojo::IOLoop
• Mojo::Client, Mojo::Server
• Mojo::Server::CGI, Mojo::Server::FastCGI
• Mojo::Server::PSGI
• Mojo::Server::Daemon и ::Prefork
• Mojo::Command
• Mojo::Command::Generate и ~ Server
![Page 66: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/66.jpg)
Mojo::ClientAsync IO HTTP 1.1 And WebSocket Client
![Page 67: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/67.jpg)
my $client = Mojo::Client->new;
$client->get( ‘http://goo.gl’ => sub { my ($self, $tx) = @_; say $tx->res; })->process;
![Page 68: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/68.jpg)
my $client = Mojo::Client->new;
$self->client->get( ‘http://goo.gl’ => sub { my ($self, $tx) = @_; say $tx->res; })->process;
![Page 69: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/69.jpg)
my $client = Mojo::Client->new;
$client->get( ‘http://goo.gl’ => sub { my ($self, $tx) = @_; say $tx->res; })->process;
![Page 70: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/70.jpg)
my $client = Mojo::Client->new;
$client->head( ‘http://goo.gl’ => sub { my ($self, $tx) = @_; say $tx->res; })->process;
![Page 71: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/71.jpg)
my $client = Mojo::Client->new;
$client->post( ‘http://goo.gl’ => sub { my ($self, $tx) = @_; say $tx->res; })->process;
![Page 72: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/72.jpg)
my $client = Mojo::Client->new;
$client->put( ‘http://goo.gl’ => sub { my ($self, $tx) = @_; say $tx->res; })->process;
![Page 73: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/73.jpg)
my $client = Mojo::Client->new;
$client->async->get( ‘http://goo.gl’ => sub { my ($self, $tx) = @_; say $tx->res; })->process;
![Page 74: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/74.jpg)
my $client = Mojo::Client->new;
$client->get( ‘http://goo.gl’ => sub { my ($self, $tx) = @_; say $tx->res; })->process;
![Page 75: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/75.jpg)
my $client = Mojo::Client->new;
$client->get( ‘http://goo.gl’ => sub { my ($self, $tx) = @_; say $tx->res; })->process;
![Page 76: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/76.jpg)
my $client = Mojo::Client->new;
$client->get( ‘http://goo.gl’ => sub { my ($self, $tx) = @_; say $tx->res; })->process;
![Page 77: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/77.jpg)
my $client = Mojo::Client->new;
$client->get(‘http://goo.gl’)->res->code;
$client->get( 'http://search.twitter.com/trends.json')->success->json->{trends}->[0]->{name}
![Page 78: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/78.jpg)
my $client = Mojo::Client->new;
$client->get(‘http://goo.gl’)->res->code;
$client->get( 'http://search.twitter.com/trends.json')->success->json->{trends}->[0]->{name}
![Page 80: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/80.jpg)
• Mojo::Trasaction
• Mojo::IOLoop
• Mojo::Client, Mojo::Server
• Mojo::Server::CGI, Mojo::Server::FastCGI
• Mojo::Server::PSGI
• Mojo::Server::Daemon и ::Prefork
• Mojo::Command
• Mojo::Command::Generate и ~ Server
![Page 81: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/81.jpg)
• Mojo::Trasaction
• Mojo::IOLoop
• Mojo::Client, Mojo::Server
• Mojo::Server::CGI, Mojo::Server::FastCGI
• Mojo::Server::PSGI
• Mojo::Server::Daemon и ::Prefork
• Mojo::Command
• Mojo::Command::Generate и ~ Server
![Page 82: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/82.jpg)
• Mojo::Trasaction
• Mojo::IOLoop
• Mojo::Client, Mojo::Server
• Mojo::Server::CGI, Mojo::Server::FastCGI
• Mojo::Server::PSGI
• Mojo::Server::Daemon и ::Prefork
• Mojo::Command
• Mojo::Command::Generate и ~ Server
![Page 83: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/83.jpg)
Всё, что нужно – естьMojolicious – веб в коробке!
![Page 84: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/84.jpg)
Без зависимостейс версии Perl 5.8.1
![Page 85: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/85.jpg)
Mojo runtime
![Page 86: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/86.jpg)
Perl 5.005
![Page 87: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/87.jpg)
Perl 5.006002
![Page 88: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/88.jpg)
Perl 5.008001
![Page 89: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/89.jpg)
Perl 5.010
![Page 90: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/90.jpg)
Объектно-ориентированное
API
![Page 91: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/91.jpg)
package App;use base 'Mojo';sub handler { my ($self, $tx) = @_; warn $tx->req; warn $tx->req->url; $tx->res->headers ->content_type('text/plain'); $tx->res->body('РИТ++ 2010');}1;
![Page 92: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/92.jpg)
package App;use base 'Mojo';sub handler { my ($self, $tx) = @_; warn $tx->req; warn $tx->req->url; $tx->res->headers ->content_type('text/plain'); $tx->res->body('РИТ++ 2010');}1;
![Page 93: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/93.jpg)
package App;use base 'Mojo';sub handler { my ($self, $tx) = @_; warn $tx->req; warn $tx->req->url; $tx->res->headers ->content_type('text/plain'); $tx->res->body('РИТ++ 2010');}1;
![Page 94: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/94.jpg)
package App;use base 'Mojo';sub handler { my ($self, $tx) = @_; warn $tx->req; warn $tx->req->url; $tx->res->headers ->content_type('text/plain'); $tx->res->body('РИТ++ 2010');}1;
![Page 95: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/95.jpg)
package App;use base 'Mojo';sub handler { my ($self, $tx) = @_; warn $tx->req; warn $tx->req->url; $tx->res->headers ->content_type('text/plain'); $tx->res->body('РИТ++ 2010');}1;
![Page 96: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/96.jpg)
package App;use base 'Mojo';sub handler { my ($self, $tx) = @_; warn $tx->req; warn $tx->req->url; $tx->res->headers ->content_type('text/plain'); $tx->res->body('РИТ++ 2010');}1;
![Page 97: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/97.jpg)
use overload '""' => sub { shift->to_string },
fallback => 1;
![Page 98: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/98.jpg)
GET / HTTP/1.1Connection: keep-aliveAccept: text/html, application/xhtml, ....Accept-Charset: windows-1251, utf-8; ...Accept-Encoding: gzip,deflateAccept-Language: ru,en-us;q=0.7,en;q=0.3Host: localhost:3000User-Agent: Mozilla/5.0 (Macintosh; ...Content-Length: 0Keep-Alive: 300
![Page 99: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/99.jpg)
package App;use base 'Mojo';sub handler { my ($self, $tx) = @_; warn $tx->req; warn $tx->req->url; $tx->res->headers ->content_type('text/plain'); $tx->res->body('РИТ++ 2010');}1;
![Page 100: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/100.jpg)
Поддержка HTTP 1.1клиент-сервер
![Page 101: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/101.jpg)
![Page 102: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/102.jpg)
Google Summer of Code 2009Pascal Gaudette
MojoX::UserAgent
![Page 103: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/103.jpg)
Поддержка WebSocketклиент-сервер
![Page 104: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/104.jpg)
Протокол WebSocketGoogle, Inc
16 декабря 2009 года
![Page 105: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/105.jpg)
use Mojolicious::Lite;
websocket ‘/echo’ => sub { my $self = shift; $self->receive_message(sub { my ($self, $msg) = @_; $self->send_massage("echo: $msg"); });};
app->start;
![Page 106: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/106.jpg)
use Mojolicious::Lite;
websocket ‘/echo’ => sub { my $self = shift; $self->receive_message(sub { my ($self, $msg) = @_; $self->send_massage("echo: $msg"); });};
app->start;
![Page 107: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/107.jpg)
Google Summer of Code 2010Performance tuning
the http/websocket implementation
![Page 108: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/108.jpg)
Поддержка CGI, FastCGI, PSGI,
Daemon и Prefork
![Page 109: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/109.jpg)
script/mojolicious COMMAND [OPTIONS]script/mojolicious cgiscript/mojolicious fastcgiscript/mojolicious psgi script/mojolicious daemonscript/mojolicious daemon_prefork
![Page 110: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/110.jpg)
script/mojolicious COMMAND [OPTIONS]script/mojolicious cgiscript/mojolicious fastcgiscript/mojolicious psgi script/mojolicious daemonscript/mojolicious daemon_prefork
![Page 111: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/111.jpg)
PATH_INFO='/foo/bar' script/mojolicious cgi
Легко тестироватьМожно профилировать код, используя Devel::NYTProf
![Page 112: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/112.jpg)
script/mojolicious COMMAND [OPTIONS]script/mojolicious cgiscript/mojolicious fastcgiscript/mojolicious psgi script/mojolicious daemonscript/mojolicious daemon_prefork
![Page 113: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/113.jpg)
Mojo::Server::FCGIscript/mojolicious fcgiscript/mojolicious fcgi_prefork
![Page 114: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/114.jpg)
script/mojolicious COMMAND [OPTIONS]script/mojolicious cgiscript/mojolicious fastcgiscript/mojolicious psgi script/mojolicious daemonscript/mojolicious daemon_prefork
![Page 115: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/115.jpg)
script/mojolicious COMMAND [OPTIONS]script/mojolicious cgiscript/mojolicious fastcgiscript/mojolicious psgi script/mojolicious daemonscript/mojolicious daemon_prefork
![Page 116: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/116.jpg)
script/mojolicious daemon --reload
Приложение перезагружается перед запросом,если код был изменен
![Page 117: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/117.jpg)
Обработка сигнала USR1Для обновления кода приложения
![Page 118: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/118.jpg)
script/mojolicious COMMAND [OPTIONS]script/mojolicious cgiscript/mojolicious fastcgiscript/mojolicious psgi script/mojolicious daemonscript/mojolicious daemon_prefork
![Page 119: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/119.jpg)
Веб-фреймворки
![Page 120: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/120.jpg)
MojoBase framework
![Page 121: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/121.jpg)
package App;use base 'Mojo';sub handler { my ($self, $tx) = @_; warn $tx->req; warn $tx->req->url; $tx->res->headers ->content_type('text/plain'); $tx->res->body('РИТ++ 2010');}1;
![Page 122: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/122.jpg)
package App;use base 'Mojo';sub handler { my ($self, $tx) = @_; warn $tx->req; warn $tx->req->url; $tx->res->headers ->content_type('text/plain'); $tx->res->body('РИТ++ 2010');}1;
![Page 123: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/123.jpg)
Генерацияmojo-приложения
![Page 124: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/124.jpg)
script/mojo generateapp App
[write ] app/script/app[chmod] app/script/app 744[write ] app/lib/App.pm[write ] app/t/basic.t[mkdir ] app/log
![Page 125: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/125.jpg)
script/app COMMAND [OPTIONS]script/app cgiscript/app fastcgiscript/app psgi script/app daemonscript/app daemon_prefork
![Page 126: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/126.jpg)
script/app COMMAND [OPTIONS]script/app getscript/app test
![Page 127: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/127.jpg)
MVC веб-фреймворки
![Page 128: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/128.jpg)
Mojolicioususe base 'Mojo';
![Page 129: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/129.jpg)
• Mojolicous::Controller
• Mojolicious::Plugins
• Mojolicious::Commands
• MojoX::Types
• MojoX::Session
• MojoX::Dispatcher, MojoX::Routes
![Page 130: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/130.jpg)
• Mojolicous::Controller
• Mojolicious::Plugins
• Mojolicious::Commands
• MojoX::Types
• MojoX::Session
• MojoX::Dispatcher, MojoX::Routes
![Page 131: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/131.jpg)
Mojolicious::ControllerController Base Class
![Page 132: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/132.jpg)
• render
• render_text
• render_data
• render_json
• render_static
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 133: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/133.jpg)
• render(controller => 'foo', action => 'bar')
• render_text
• render_data
• render_json
• render_static
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 134: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/134.jpg)
• render(template => 'foo/bar')
• render_text
• render_data
• render_json
• render_static
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 135: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/135.jpg)
• render('foo#bar')
• render_text
• render_data
• render_json
• render_static
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 136: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/136.jpg)
• render('foo#bar', format => 'html')
• render_text
• render_data
• render_json
• render_static
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 137: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/137.jpg)
• render
• render_text
• render_data
• render_json
• render_static
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 138: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/138.jpg)
• render
• render_text('РИТ++ 2010')
• render_data
• render_json
• render_static
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 139: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/139.jpg)
• render
• render(text => 'РИТ++ 2010')
• render_data
• render_json
• render_static
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 140: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/140.jpg)
• render
• render_text
• render_data
• render_json
• render_static
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 141: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/141.jpg)
• render
• render_text
• render_data('binary data')
• render_json
• render_static
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 142: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/142.jpg)
• render
• render_text
• render(data => 'binary data')
• render_json
• render_static
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 143: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/143.jpg)
• render
• render_text
• render_data
• render_json
• render_static
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 144: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/144.jpg)
• render
• render_text
• render_data
• render_json({foo => 'bar'})
• render_static
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 145: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/145.jpg)
• render
• render_text
• render_data
• render(json => {foo => 'bar'})
• render_static
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 146: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/146.jpg)
• render
• render_text
• render_data
• render_json
• render_static
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 147: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/147.jpg)
• render
• render_text
• render_data
• render_json
• render_static('img/logo.png')
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 148: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/148.jpg)
• render
• render_text
• render_data
• render_json
• render_static
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 149: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/149.jpg)
• render
• render_text
• render_data
• render_json
• render_static
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 150: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/150.jpg)
• render
• render_text
• render_data
• render_json
• render_static
• render_not_found / render_exception
• send_message / receive_message
• url_for / redirect_to
![Page 151: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/151.jpg)
• Mojolicous::Controller
• Mojolicious::Plugins
• Mojolicious::Commands
• MojoX::Types
• MojoX::Session
• MojoX::Dispatcher, MojoX::Routes
![Page 152: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/152.jpg)
Mojolicious::PluginPlugins
![Page 153: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/153.jpg)
• AgentCondition
• Charset
• DefaultHelpers
• EplRenderer
• EpRenderer
• HeaderCondition
• I18n, JsonConfig, PoweredBy
• PodRenderer, RequestTimer
![Page 154: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/154.jpg)
• AgentCondition
• Charset
• DefaultHelpers
• EplRenderer
• EpRenderer
• HeaderCondition
• I18n, JsonConfig, PoweredBy
• PodRenderer, RequestTimer
![Page 155: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/155.jpg)
• dumper
• param
• stash
• layout
• include
• content
• extends
• url_for
![Page 156: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/156.jpg)
• Data::Dumper (Maxdepth: 2, Indent: 1, Terse: 1)
• param
• stash
• layout
• include
• content
• extends
• url_for
![Page 157: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/157.jpg)
• dumper
• param
• stash
• layout
• include
• content
• extends
• url_for
![Page 158: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/158.jpg)
• dumper
• $self->req->param( ... )
• stash
• layout
• include
• content
• extends
• url_for
![Page 159: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/159.jpg)
• dumper
• param
• stash
• layout
• include
• content
• extends
• url_for
![Page 160: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/160.jpg)
• dumper
• param
• $self->stash( ... )
• layout
• include
• content
• extends
• url_for
![Page 161: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/161.jpg)
• dumper
• param
• stash
• layout
• include
• content
• extends
• url_for
![Page 162: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/162.jpg)
• dumper
• param
• stash
• layout
• include
• content
• extends
• url_for
![Page 163: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/163.jpg)
• dumper
• param
• stash
• layout
• include
• content
• extends
• url_for
![Page 164: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/164.jpg)
• dumper
• param
• stash
• layout
• include
• content
• extends
• url_for
![Page 165: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/165.jpg)
• dumper
• param
• stash
• layout
• include
• content
• extends
• url_for
![Page 166: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/166.jpg)
• dumper
• param
• stash
• layout
• include
• content
• extends
• $self->url_for
![Page 167: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/167.jpg)
• AgentCondition
• Charset
• DefaultHelpers
• EplRenderer
• EpRenderer
• HeaderCondition
• I18n, JsonConfig, PoweredBy
• PodRenderer, RequestTimer
![Page 168: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/168.jpg)
EplRendererEmbed Perl Lite
![Page 169: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/169.jpg)
• расширение шаблонов .epl
• в начале каждого шаблона:% my $self = shift;
• $self->stash('foo')
![Page 170: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/170.jpg)
• AgentCondition
• Charset
• DefaultHelpers
• EplRenderer
• EpRenderer
• HeaderCondition
• I18n, JsonConfig, PoweredBy
• PodRenderer, RequestTimer
![Page 171: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/171.jpg)
EpRendererEmbed Perl
![Page 172: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/172.jpg)
• расширение шаблонов .ep
• кеширование шаблонов со stash-параметрами
• вместо $self->stash('foo') – $foo
• доступны все helpers:
% layout 'default';
% warn dumper $list;
• обработчик по умолчанию в mojolicious
![Page 173: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/173.jpg)
• Mojolicous::Controller
• Mojolicious::Plugins
• Mojolicious::Commands
• MojoX::Types
• MojoX::Session
• MojoX::Dispatcher, MojoX::Routes
![Page 174: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/174.jpg)
• Mojolicous::Controller
• Mojolicious::Plugins
• Mojolicious::Commands
• MojoX::Types
• MojoX::Session
• MojoX::Dispatcher, MojoX::Routes
![Page 175: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/175.jpg)
• Mojolicous::Controller
• Mojolicious::Plugins
• Mojolicious::Commands
• MojoX::Types
• MojoX::Session
• MojoX::Dispatcher, MojoX::Routes
![Page 176: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/176.jpg)
• Mojolicous::Controller
• Mojolicious::Plugins
• Mojolicious::Commands
• MojoX::Types
• MojoX::Session
• MojoX::Dispatcher, MojoX::Routes
![Page 177: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/177.jpg)
Генерацияmojolicious-приложения
![Page 178: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/178.jpg)
script/mojolicious generateapp App
[write ] app/script/app[chmod] app/script/app 744[write ] app/lib/App.pm[write ] app/lib/App/Example.pm[write ] app/t/basic.t[mkdir ] app/log
![Page 179: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/179.jpg)
package App;use base 'Mojolicious';
sub startup { my $self = shift; my $r = $self->routes; $r->route('/:controller/:action/:id') ->to('example#welcome', id => 1);}
1;
![Page 180: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/180.jpg)
package App;use base 'Mojolicious';
sub startup { my $self = shift; my $r = $self->routes; $r->route('/:controller/:action/:id') ->to('example#welcome', id => 1);}
1;
![Page 181: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/181.jpg)
package App;use base 'Mojolicious';
sub startup { my $self = shift; my $r = $self->routes; $r->route('/:controller/:action/:id') ->to('example#welcome', id => 1);}
1;
![Page 182: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/182.jpg)
package App;use base 'Mojolicious';
sub startup { my $self = shift; my $r = $self->routes; $r->route('/:controller/:action/:id') ->to('example#welcome', id => 1);}
1;
![Page 183: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/183.jpg)
package App;use base 'Mojolicious';
sub startup { my $self = shift; my $r = $self->routes; $r->route('/:controller/:action/:id') ->to('example#welcome', id => 1);}
1;
![Page 184: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/184.jpg)
package App;use base 'Mojolicious';
sub startup { my $self = shift; my $r = $self->routes; $r->route('/:id', id => qr/\d+/) ->to('example#welcome');}
1;
![Page 185: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/185.jpg)
package App;use base 'Mojolicious';
sub startup { my $self = shift; my $r = $self->routes; for ($r->bridge->to('auth#check) { $_->route('/admin')->to('admin#welcome'); }}
![Page 186: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/186.jpg)
package App;use base 'Mojolicious';
sub startup { my $self = shift; my $r = $self->routes; for ($r->bridge->to('auth#check) { $_->route('/admin')->to('admin#welcome'); }}
![Page 187: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/187.jpg)
package App;use base 'Mojolicious';
sub startup { my $self = shift; my $r = $self->routes; $r->route('/:controller/:action/:id') ->to('example#welcome', id => 1);}
1;
![Page 188: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/188.jpg)
script/mojolicious generateapp App
[write ] app/script/app[chmod] app/script/app 744[write ] app/lib/App.pm[write ] app/lib/App/Example.pm[write ] app/t/basic.t[mkdir ] app/log
![Page 189: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/189.jpg)
package App::Example;use base 'Mojolicious::Controller';
sub welcome { my $self = shift; warn $self->stash(‘id’); $self->render(message => 'РИТ++ 2010');}
1;
![Page 190: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/190.jpg)
package App::Example;use base 'Mojolicious::Controller';
sub welcome { my $self = shift; warn $self->stash(‘id’); $self->render(message => 'РИТ++ 2010');}
1;
![Page 191: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/191.jpg)
package App::Example;use base 'Mojolicious::Controller';
sub welcome { my $self = shift; warn $self->stash(‘id’); $self->render(message => 'РИТ++ 2010');}
1;
![Page 192: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/192.jpg)
script/mojolicious generateapp App
[mkdir] app/public[write ] app/templates/not_found.html.ep[write ] app/templates/exception.html.ep[write ] app/templates/layouts/default.html.ep[write ] app/templates/example/welcome.html.ep
![Page 193: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/193.jpg)
script/mojolicious generateapp App
[mkdir] app/public[write ] app/templates/not_found.html.ep[write ] app/templates/exception.html.ep[write ] app/templates/layouts/default.html.ep[write ] app/templates/example/welcome.html.ep
![Page 194: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/194.jpg)
script/mojolicious generateapp App
[mkdir] app/public[write ] app/templates/not_found.html.ep[write ] app/templates/exception.html.ep[write ] app/templates/layouts/default.html.ep[write ] app/templates/example/welcome.html.ep
![Page 195: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/195.jpg)
% layout 'default';
<h2><%= $message %></h2>
<a href="<%== url_for %>">click here</a>
![Page 196: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/196.jpg)
% layout 'default';
<h2><%= $message %></h2>
<a href="<%== url_for %>">click here</a>
![Page 197: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/197.jpg)
% layout 'default';
<h2><%= $self->stash('message') %></h2>
<a href="<%== url_for %>">click here</a>
![Page 198: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/198.jpg)
% layout 'default';
<h2><%= $message %></h2>
<a href="<%== url_for %>">click here</a>
![Page 199: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/199.jpg)
% layout 'default';
<h2><%= stash 'message' %></h2>
<a href="<%== url_for %>">click here</a>
![Page 200: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/200.jpg)
% layout 'default';
<h2><%= $message %></h2>
<a href="<%== url_for %>">click here</a>
![Page 201: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/201.jpg)
script/mojolicious generateapp App
[mkdir] app/public[write ] app/templates/not_found.html.ep[write ] app/templates/exception.html.ep[write ] app/templates/layouts/default.html.ep[write ] app/templates/example/welcome.html.ep
![Page 202: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/202.jpg)
<!doctype html><html> <head><title>Welcome</title></head> <body> <%== content %> </body></html>
![Page 203: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/203.jpg)
<!doctype html><html> <head><title>Welcome</title></head> <body> <%== content %> </body></html>
![Page 204: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/204.jpg)
script/mojolicious generateapp App
[mkdir] app/public[write ] app/templates/not_found.html.ep[write ] app/templates/exception.html.ep[write ] app/templates/layouts/default.html.ep[write ] app/templates/example/welcome.html.ep
![Page 205: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/205.jpg)
script/mojolicious generateapp App
[mkdir] app/public[write ] app/templates/not_found.html.ep[write ] app/templates/exception.html.ep[write ] app/templates/layouts/default.html.ep[write ] app/templates/example/welcome.html.ep
![Page 206: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/206.jpg)
Global symbol "$message2" requires explicit package name at (eval 280) line 2.
1: % layout 'default';2: <h2><%= $message2 %></h2>3: ...
{ 'status' => 500, 'message' => ‘РИТ++ 2010’, ...
![Page 207: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/207.jpg)
example/welcome.html.ep
Автоматическая генерация имени шаблона
![Page 208: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/208.jpg)
controller/action.format.handler
Автоматическая генерация имени шаблона
![Page 209: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/209.jpg)
example/welcome.html.ep
Автоматическая генерация имени шаблона
![Page 210: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/210.jpg)
example/welcome.xml.ep
Автоматическая генерация имени шаблона
![Page 211: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/211.jpg)
example/welcome.rss.ep
Автоматическая генерация имени шаблона
![Page 212: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/212.jpg)
example/welcome.json.ep
Автоматическая генерация имени шаблона
![Page 213: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/213.jpg)
example/welcome.html.ep
Автоматическая генерация имени шаблона
![Page 214: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/214.jpg)
example/welcome.html.epl
Автоматическая генерация имени шаблона
![Page 215: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/215.jpg)
example/welcome.html.tt
Автоматическая генерация имени шаблона
![Page 216: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/216.jpg)
example/welcome.html.cttp2 Автоматическая генерация имени шаблона
![Page 217: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/217.jpg)
script/app COMMAND [OPTIONS]script/app cgiscript/app fastcgiscript/app psgi script/app daemonscript/app daemon_prefork
![Page 218: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/218.jpg)
script/app COMMAND [OPTIONS]script/app getscript/app testscript/app routes
![Page 219: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/219.jpg)
Mojolicious::Liteuse base 'Mojolicious';
![Page 220: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/220.jpg)
script/mojolicious generatelite_app lite.pl
[write ] lite.pl[chmod] lite.pl 744
![Page 221: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/221.jpg)
use Mojolicious::Lite;
get '/' => 'index';
get '/:groovy' => sub { my $self = shift; $self->render_text( $self->param('groovy') );};
app->start;
![Page 222: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/222.jpg)
use Mojolicious::Lite;
get '/' => 'index';
get '/:groovy' => sub { my $self = shift; $self->render_text( $self->param('groovy') );};
app->start;
![Page 223: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/223.jpg)
use Mojolicious::Lite;
get '/' => 'index';
get '/:groovy' => sub { my $self = shift; $self->render_text( $self->param('groovy') );};
app->start;
![Page 224: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/224.jpg)
use Mojolicious::Lite;
post '/' => 'index';
get '/:groovy' => sub { my $self = shift; $self->render_text( $self->param('groovy') );};
app->start;
![Page 225: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/225.jpg)
use Mojolicious::Lite;
any '/' => 'index';
get '/:groovy' => sub { my $self = shift; $self->render_text( $self->param('groovy') );};
app->start;
![Page 226: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/226.jpg)
use Mojolicious::Lite;
get '/' => (agent => qr/Firefox/) => 'index';
get '/:groovy' => sub { my $self = shift; $self->render_text( $self->param('groovy') );};
app->start;
![Page 227: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/227.jpg)
use Mojolicious::Lite;
get '/' => 'index';
get '/:groovy' => {groovy => 42} => sub { my $self = shift; $self->render_text( $self->param('groovy') );};
app->start;
![Page 228: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/228.jpg)
use Mojolicious::Lite;
get '/' => 'index';
get '/:groovy' => [groovy => qr/\d+/] => sub { my $self = shift; $self->render_text( $self->param('groovy') );};
app->start;
![Page 229: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/229.jpg)
use Mojolicious::Lite;ladder sub {}; # authget '/' => 'index';
get '/:groovy' => sub { my $self = shift; $self->render_text( $self->param('groovy') );};
app->start;
![Page 230: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/230.jpg)
use Mojolicious::Lite;websocket '/echo' => sub { ... }; get '/' => 'index';
get '/:groovy' => sub { my $self = shift; $self->render_text( $self->param('groovy') );};
app->start;
![Page 231: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/231.jpg)
use Mojolicious::Lite;
get '/' => 'index';
get '/:groovy' => sub { my $self = shift; $self->render_text( $self->param('groovy') );};app->renderer->default_handler('epl');app->start;
![Page 232: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/232.jpg)
use Mojolicious::Lite;
get '/' => 'index';
get '/:groovy' => sub { my $self = shift; $self->render_text( $self->param('groovy') );};
app->start;
![Page 233: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/233.jpg)
__DATA__
@@ index.html.ep% layout 'funky';Yea baby!
@@ layouts/funky.html.ep<!doctype html><html> <head><title>Funky!</title></head> <body><%== content %></body></html>
![Page 234: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/234.jpg)
__DATA__
@@ index.html.ep% layout 'funky';Yea baby!
@@ layouts/funky.html.ep<!doctype html><html> <head><title>Funky!</title></head> <body><%== content %></body></html>
![Page 235: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/235.jpg)
lite.pl COMMAND [OPTIONS]
lite.pl cgilite.pl fastcgilite.pl psgilite.pl daemonlite.pl daemon_prefork
![Page 236: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/236.jpg)
lite.pl COMMAND [OPTIONS]
lite.pl testlite.pl getlite.pl routeslite.pl inflate
![Page 237: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/237.jpg)
«Making hard things possible and everything fun!»
Девиз Mojolicious
![Page 238: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/238.jpg)
«Viva la revolution!»
Девиз Mojolicious #2
![Page 239: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/239.jpg)
«Duct tape for the HTML5 web»
Девиз Mojolicious #3
![Page 240: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/240.jpg)
Mojolicious-модули на CPAN• Mojolicious
• Mojo::Server::FCGI
• AnyEvent::Mojo
• Apache::Mojo
Apache2::Mojo
• Catalyst::Engine::MojoSquatting::On::Mojo
• MojoX::Routes::AsGraph
• MojoX::Log::*
• MojoX::Renderer::*
• TT
• CTTP2, HTP
• XSLT
![Page 241: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/241.jpg)
Стабильная версия, совместимость?
![Page 242: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/242.jpg)
Обратная совместимость не гарантируется :)
До первой стабильной версии
![Page 243: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/243.jpg)
Mojolicious 0.999925Последняя версия доступна на github.com
![Page 244: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/244.jpg)
Документация
• Пока не очень :) • Mojolicious::Lite и Mojolicious::Guides
• Mojolicious Handbook на github.com @kvorg
• Mojolicious FAQ на github.com @vti
![Page 245: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/245.jpg)
Полезная информация• http://mojolicious.org
• irc://irc.perl.org/#mojo
• http://groups.google.com/group/mojolicious
• Github: kraih, vti, xantus
• Twitter: @kraih, @vtivti, @sharifulin
• Juick: @vti, @sharifulin
![Page 246: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/246.jpg)
use Mojoliciousor die;
![Page 247: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/247.jpg)
Viva la revolution!
![Page 248: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/248.jpg)
use Perlor die;
![Page 249: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/249.jpg)
JFDI
![Page 250: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/250.jpg)
any ‘/questions’ => sub { shift->render( answer => ‘sharifulin’, ); };
![Page 251: анатолий шарифулин Mojolicious](https://reader034.fdocument.pub/reader034/viewer/2022052307/555109a2b4c90572478b5477/html5/thumbnails/251.jpg)
Спасибо за внимание!Это 251й слайдАнатолий Шарифулин