Download - Mojolicious lite
Disclaimer
[Web] developer profissional
Perl::Newbie
#{coisas certas} > #{coisas erradas}
Disclaimer
[Web] developer profissional
Perl::Newbie
#{coisas certas} > #{coisas erradas}
Disclaimer
[Web] developer profissional
Perl::Newbie
#{coisas certas} > #{coisas erradas}
Ruby
Ruby on Rails“open source MVC web app framework”
PerlCatalyst(outros)
Ruby
Ruby on Rails“open source MVC web app framework”
Perl
Catalyst(outros)
RubyRuby on Rails“open source MVC web app framework”
Perl
Catalyst(outros)
RubyRuby on Rails“open source MVC web app framework”
PerlCatalyst(outros)
Ruby
Sinatrapequenas aplicacoes web
Perl
Mojolicious::Lite“micro web framework”
RubySinatrapequenas aplicacoes web
Perl
Mojolicious::Lite“micro web framework”
RubySinatrapequenas aplicacoes web
PerlMojolicious::Lite“micro web framework”
/Mojo.*/
Mojo
Mojolicious
Mojolicious::Lite
criados por Sebastian RiedelI tambem criador de CatalystI developer RoR
/Mojo.*/
Mojo
Mojolicious
Mojolicious::Lite
criados por Sebastian RiedelI tambem criador de CatalystI developer RoR
/Mojo.*/
.---------------------------------------------------------------.| Fun! |’---------------------------------------------------------------’.---------------------------------------------------------------.| || .----------------------------------------------’| | .--------------------------------------------.| Application | | Mojolicious::Lite || | ’--------------------------------------------’| | .--------------------------------------------.| | | Mojolicious |’----------------’ ’--------------------------------------------’.---------------------------------------------------------------.| Mojo |’---------------------------------------------------------------’.-------. .-----------. .--------. .------------. .-------------.| CGI | | FastCGI | | PSGI | | HTTP 1.1 | | WebSocket |’-------’ ’-----------’ ’--------’ ’------------’ ’-------------’
/Mojo.*/
Mojo“The box!”
Encapsula as complexidades de CGI,
FastCGI, PSGI, HTTP e WebSocket num
so metodo
Da suporte a frameworks web como
Mojolicious e Mojolicious::Lite
/Mojo.*/
Mojolicious“The web in a box!”
framework MVC com API OO Perl
depende apenas de Perl 5.8.1
Mojolicious::Lite
Single file micro web apps framework
NAO!Nao apropriado para producao, software
comercial, ...
Nao apropriado para aplicacoes complexas
Nao esta bem documentado (ainda)
Mojolicious::Lite
Single file micro web apps framework
NAO!Nao apropriado para producao, software
comercial, ...
Nao apropriado para aplicacoes complexas
Nao esta bem documentado (ainda)
Mojolicious::Lite
Single file micro web apps framework
NAO!Nao apropriado para producao, software
comercial, ...
Nao apropriado para aplicacoes complexas
Nao esta bem documentado (ainda)
$ mojolicious generate lite_app
[exist] ~/folder
[write] ~/folder/myapp.pl
[chmod] myapp.pl 744
$ myapp.pl...generate Generate files and directories from templates.routes Show available routes.inflate Inflate embedded files to real files.version Show versions of installed modules.daemon_prefork Start application w/prefork HTTP 1.1 backend.fastcgi Start application with FastCGI backend.daemon Start application with HTTP 1.1 backend.cgi Start application with CGI backend.get Get file from URL.psgi Start application with PSGI backend.test Run unit tests.
$ cat myapp.pl#!/usr/bin/env perluse Mojolicious::Lite;
get ’/’ => ’index’;get ’/:groovy’ => sub {
my $self = shift;$self->render_text($self->param(’groovy’), layout => ’funky’);
};
shagadelic;
__DATA__@@ index.html.ep% layout ’funky’;Yea baby!
@@ layouts/funky.html.ep<!doctype html><html>
<head><title>Funky!</title></head><body><%== content %></body>
</html>
$ cat myapp.pl#!/usr/bin/env perluse Mojolicious::Lite;
get ’/’ => ’index’;get ’/:groovy’ => sub {
my $self = shift;$self->render_text($self->param(’groovy’), layout => ’funky’);
};
shagadelic;
__DATA__@@ index.html.ep% layout ’funky’;Yea baby!
@@ layouts/funky.html.ep<!doctype html><html>
<head><title>Funky!</title></head><body><%== content %></body>
</html>
$ cat myapp.pl#!/usr/bin/env perluse Mojolicious::Lite;
get ’/’ => ’index’;get ’/:groovy’ => sub {
my $self = shift;$self->render_text($self->param(’groovy’), layout => ’funky’);
};
app->start;
__DATA__@@ index.html.ep% layout ’funky’;Yea baby!
@@ layouts/funky.html.ep<!doctype html><html>
<head><title>Funky!</title></head><body><%== content %></body>
</html>
Routes
get ’/’ => ’index’ # GET ’/’
get ’/:groovy’ => sub
# GET ’/anyword’
get ’/perl’ # GET ’/perl’
any [qw/post delete/] ’/bar/:foo’
# ’ POST or DELETE ’/bar/*’
any ’/:foo’ => [foo => qr/+./]
# ’/2010’
get ’/number/:num’ => {num => 42}
get ’/path/(*everything)
Routes
get ’/’ => ’index’ # GET ’/’
get ’/:groovy’ => sub
# GET ’/anyword’
get ’/perl’ # GET ’/perl’
any [qw/post delete/] ’/bar/:foo’
# ’ POST or DELETE ’/bar/*’
any ’/:foo’ => [foo => qr/+./]
# ’/2010’
get ’/number/:num’ => {num => 42}
get ’/path/(*everything)
Routes
get ’/’ => ’index’ # GET ’/’
get ’/:groovy’ => sub
# GET ’/anyword’
get ’/perl’ # GET ’/perl’
any [qw/post delete/] ’/bar/:foo’
# ’ POST or DELETE ’/bar/*’
any ’/:foo’ => [foo => qr/+./]
# ’/2010’
get ’/number/:num’ => {num => 42}
get ’/path/(*everything)
Templates
Sistema de templates proprio; ou
Template Toolkit, ...
Exemploshttp://d.hatena.ne.jp/yukikimoto/20100220/1266588242
Short message BSS (150 loc)
Image BSS (156 loc)
Simple search (106 loc)
Simple real time clock (133 loc)
Simple real time chat (207 loc)
$ myapp.pl inflate
[mkdir] ~/folder/templates/layouts
[write] ~/folder/templates/layouts/funky.html.ep
[exist] ~/folder/templates
[write] ~/folder/templates/index.html.ep
Trabalho semelhante
Sinatra on Perl,github.com/jtarchie/
sinatra-on-perl
Schenker,github.com/spiritloose/Schenker
Dancer,perldancer.org
Mojolicious::Lite vs Dancerhttp://use.perl.org/~Alias/journal/
Trabalho semelhante
Sinatra on Perl,github.com/jtarchie/
sinatra-on-perl
Schenker,github.com/spiritloose/Schenker
Dancer,perldancer.org
Mojolicious::Lite vs Dancerhttp://use.perl.org/~Alias/journal/
Questions
o/