SlideShare a Scribd company logo
1 of 32
Download to read offline
Mini aplicac˜es web com
            ¸o
Mojolicious::Lite
         Andr´ Santos
              e
       andrefs@cpan.org

       PtPW 2010
         5 de Julho
Disclaimer


   [Web] developer profissional
Disclaimer


   [Web] developer profissional
   Perl::Newbie
Disclaimer


   [Web] developer profissional
   Perl::Newbie

   #{coisas certas} > #{coisas erradas}
Ruby
Ruby



Perl
Ruby
Ruby on Rails
“open source MVC web app framework”

Perl
Ruby
Ruby on Rails
“open source MVC web app framework”

Perl
Catalyst
(outros)
Ruby



Perl
Ruby
Sinatra
pequenas aplicac˜es web
               ¸o

Perl
Ruby
Sinatra
pequenas aplicac˜es web
               ¸o

Perl
Mojolicious::Lite
“micro web framework”
/Mojo.*/

   Mojo
   Mojolicious
   Mojolicious::Lite
/Mojo.*/

   Mojo
   Mojolicious
   Mojolicious::Lite

   criados por Sebastian Riedel
       tamb´m criador de Catalyst
            e
       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
  s´ m´todo
   o e
  D´ suporte a frameworks web como
    a
  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!
    N˜o apropriado para produc˜o, software
      a                      ¸a
    comercial, ...
Mojolicious::Lite

Single file micro web apps framework
 ˜
NAO!
    N˜o apropriado para produc˜o, software
      a                       ¸a
    comercial, ...
    N˜o apropriado para aplicac˜es complexas
      a                       ¸o
Mojolicious::Lite

Single file micro web apps framework
 ˜
NAO!
    N˜o apropriado para produc˜o, software
      a                       ¸a
    comercial, ...
    N˜o apropriado para aplicac˜es complexas
      a                       ¸o
    N˜o est´ bem documentado (ainda)
      a    a
$ 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 perl
use 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 perl
use 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 perl
use 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’
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’
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 pr´prio; ou
                          o
   Template Toolkit, ...
Exemplos
http://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.
 [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
Trabalho semelhante
   Sinatra on Perl,
   github.com/jtarchie/
   sinatra-on-perl
   Schenker,
   github.com/spiritloose/Schenker
   Dancer,
   perldancer.org

Mojolicious::Lite vs Dancer
http://use.perl.org/~Alias/journal/
Questions




            o/

More Related Content

What's hot

Lightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientLightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientAdam Wiggins
 
Quick and Dirty Python Deployments with Heroku
Quick and Dirty Python Deployments with HerokuQuick and Dirty Python Deployments with Heroku
Quick and Dirty Python Deployments with HerokuDaniel Pritchett
 
Html5, css3, canvas, svg and webgl
Html5, css3, canvas, svg and webglHtml5, css3, canvas, svg and webgl
Html5, css3, canvas, svg and webglKilian Valkhof
 
Real-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.ioReal-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.ioRick Copeland
 
Rush, a shell that will yield to you
Rush, a shell that will yield to youRush, a shell that will yield to you
Rush, a shell that will yield to youguestdd9d06
 
mruby で mackerel のプラグインを作るはなし
mruby で mackerel のプラグインを作るはなしmruby で mackerel のプラグインを作るはなし
mruby で mackerel のプラグインを作るはなしHiroshi SHIBATA
 
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)Brian Sam-Bodden
 
Basicsof c make and git for a hello qt application
Basicsof c make and git for a hello qt applicationBasicsof c make and git for a hello qt application
Basicsof c make and git for a hello qt applicationDinesh Manajipet
 
Cooking Up Drama - ChefConf 2015
Cooking Up Drama - ChefConf 2015 Cooking Up Drama - ChefConf 2015
Cooking Up Drama - ChefConf 2015 Chef
 
Implementing pattern-matching in JavaScript (short version)
Implementing pattern-matching in JavaScript (short version)Implementing pattern-matching in JavaScript (short version)
Implementing pattern-matching in JavaScript (short version)François-Guillaume Ribreau
 
Go初心者がGoでコマンドラインツールの作成に挑戦した話
Go初心者がGoでコマンドラインツールの作成に挑戦した話Go初心者がGoでコマンドラインツールの作成に挑戦した話
Go初心者がGoでコマンドラインツールの作成に挑戦した話dcubeio
 
Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101hendrikvb
 
HTTPS + Let's Encrypt
HTTPS + Let's EncryptHTTPS + Let's Encrypt
HTTPS + Let's EncryptWalter Ebert
 

What's hot (19)

Lightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientLightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClient
 
Triple Blitz Strike
Triple Blitz StrikeTriple Blitz Strike
Triple Blitz Strike
 
Quick and Dirty Python Deployments with Heroku
Quick and Dirty Python Deployments with HerokuQuick and Dirty Python Deployments with Heroku
Quick and Dirty Python Deployments with Heroku
 
Start using vagrant now!
Start using vagrant now!Start using vagrant now!
Start using vagrant now!
 
Html5, css3, canvas, svg and webgl
Html5, css3, canvas, svg and webglHtml5, css3, canvas, svg and webgl
Html5, css3, canvas, svg and webgl
 
Real-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.ioReal-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.io
 
Qless
QlessQless
Qless
 
Rush, a shell that will yield to you
Rush, a shell that will yield to youRush, a shell that will yield to you
Rush, a shell that will yield to you
 
mruby で mackerel のプラグインを作るはなし
mruby で mackerel のプラグインを作るはなしmruby で mackerel のプラグインを作るはなし
mruby で mackerel のプラグインを作るはなし
 
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)
 
Basicsof c make and git for a hello qt application
Basicsof c make and git for a hello qt applicationBasicsof c make and git for a hello qt application
Basicsof c make and git for a hello qt application
 
Cooking Up Drama
Cooking Up DramaCooking Up Drama
Cooking Up Drama
 
Cooking Up Drama - ChefConf 2015
Cooking Up Drama - ChefConf 2015 Cooking Up Drama - ChefConf 2015
Cooking Up Drama - ChefConf 2015
 
Implementing pattern-matching in JavaScript (short version)
Implementing pattern-matching in JavaScript (short version)Implementing pattern-matching in JavaScript (short version)
Implementing pattern-matching in JavaScript (short version)
 
Perl dancer
Perl dancerPerl dancer
Perl dancer
 
About Data::ObjectDriver
About Data::ObjectDriverAbout Data::ObjectDriver
About Data::ObjectDriver
 
Go初心者がGoでコマンドラインツールの作成に挑戦した話
Go初心者がGoでコマンドラインツールの作成に挑戦した話Go初心者がGoでコマンドラインツールの作成に挑戦した話
Go初心者がGoでコマンドラインツールの作成に挑戦した話
 
Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101
 
HTTPS + Let's Encrypt
HTTPS + Let's EncryptHTTPS + Let's Encrypt
HTTPS + Let's Encrypt
 

Viewers also liked

Cleaning plain text books with Text::Perfide::BookCleaner
Cleaning plain text books with Text::Perfide::BookCleanerCleaning plain text books with Text::Perfide::BookCleaner
Cleaning plain text books with Text::Perfide::BookCleanerandrefsantos
 
Professional Certifications
Professional CertificationsProfessional Certifications
Professional Certificationseeakin79
 
Student leadership in conduct symposiumonline
Student leadership in conduct   symposiumonlineStudent leadership in conduct   symposiumonline
Student leadership in conduct symposiumonlineTEDx Adventure Catalyst
 
Maestri necunoscuti j (lh)
Maestri necunoscuti j (lh)Maestri necunoscuti j (lh)
Maestri necunoscuti j (lh)filipj2000
 
Colchon flotable a luz solar
Colchon flotable a luz solarColchon flotable a luz solar
Colchon flotable a luz solarLili Krrillo
 
Examples of our website work
Examples of our website workExamples of our website work
Examples of our website workJeremy Dawes
 
乘科技風潮 學術生涯規劃
乘科技風潮 學術生涯規劃乘科技風潮 學術生涯規劃
乘科技風潮 學術生涯規劃tpliang
 
242260 rosette1945
242260 rosette1945242260 rosette1945
242260 rosette1945filipj2000
 
Pps delz@-budapest - i - left bank-the historic part and more
Pps delz@-budapest - i - left bank-the historic part and morePps delz@-budapest - i - left bank-the historic part and more
Pps delz@-budapest - i - left bank-the historic part and morefilipj2000
 
The Worry Line Incision
The Worry Line IncisionThe Worry Line Incision
The Worry Line Incisionmoosews
 
Set a featured image of a page in WordPress
Set a featured image of a page in WordPressSet a featured image of a page in WordPress
Set a featured image of a page in WordPressJeremy Dawes
 
Thunderbird imap settings
Thunderbird imap settingsThunderbird imap settings
Thunderbird imap settingsJeremy Dawes
 

Viewers also liked (19)

Cleaning plain text books with Text::Perfide::BookCleaner
Cleaning plain text books with Text::Perfide::BookCleanerCleaning plain text books with Text::Perfide::BookCleaner
Cleaning plain text books with Text::Perfide::BookCleaner
 
Professional Certifications
Professional CertificationsProfessional Certifications
Professional Certifications
 
Student leadership in conduct symposiumonline
Student leadership in conduct   symposiumonlineStudent leadership in conduct   symposiumonline
Student leadership in conduct symposiumonline
 
Universal Design August Workshop
Universal Design August Workshop Universal Design August Workshop
Universal Design August Workshop
 
Chine
ChineChine
Chine
 
Maestri necunoscuti j (lh)
Maestri necunoscuti j (lh)Maestri necunoscuti j (lh)
Maestri necunoscuti j (lh)
 
Final mh 101 for owls 2015(1)
Final mh 101 for owls 2015(1)Final mh 101 for owls 2015(1)
Final mh 101 for owls 2015(1)
 
Colchon flotable a luz solar
Colchon flotable a luz solarColchon flotable a luz solar
Colchon flotable a luz solar
 
Examples of our website work
Examples of our website workExamples of our website work
Examples of our website work
 
El proceso
El procesoEl proceso
El proceso
 
乘科技風潮 學術生涯規劃
乘科技風潮 學術生涯規劃乘科技風潮 學術生涯規劃
乘科技風潮 學術生涯規劃
 
242260 rosette1945
242260 rosette1945242260 rosette1945
242260 rosette1945
 
Pps delz@-budapest - i - left bank-the historic part and more
Pps delz@-budapest - i - left bank-the historic part and morePps delz@-budapest - i - left bank-the historic part and more
Pps delz@-budapest - i - left bank-the historic part and more
 
La Excepción
La ExcepciónLa Excepción
La Excepción
 
The Worry Line Incision
The Worry Line IncisionThe Worry Line Incision
The Worry Line Incision
 
Dr Natalia Haraszkiewicz-Birkemeier_KWF Kankerbestrijding
Dr Natalia Haraszkiewicz-Birkemeier_KWF KankerbestrijdingDr Natalia Haraszkiewicz-Birkemeier_KWF Kankerbestrijding
Dr Natalia Haraszkiewicz-Birkemeier_KWF Kankerbestrijding
 
Pdf 1
Pdf 1Pdf 1
Pdf 1
 
Set a featured image of a page in WordPress
Set a featured image of a page in WordPressSet a featured image of a page in WordPress
Set a featured image of a page in WordPress
 
Thunderbird imap settings
Thunderbird imap settingsThunderbird imap settings
Thunderbird imap settings
 

Similar to Mojolicious lite

Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hopeMarcus Ramberg
 
Baremetal deployment scale
Baremetal deployment scaleBaremetal deployment scale
Baremetal deployment scalebaremetal
 
Caching with Varnish
Caching with VarnishCaching with Varnish
Caching with Varnishschoefmax
 
Dexterity in 15 minutes or less
Dexterity in 15 minutes or lessDexterity in 15 minutes or less
Dexterity in 15 minutes or lessrijk.stofberg
 
PHP QA Tools
PHP QA ToolsPHP QA Tools
PHP QA Toolsrjsmelo
 
Pyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web appsPyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web appsDylan Jay
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.catPablo Godel
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Herokuronnywang_tw
 
Baremetal deployment
Baremetal deploymentBaremetal deployment
Baremetal deploymentbaremetal
 
Scripting for infosecs
Scripting for infosecsScripting for infosecs
Scripting for infosecsnancysuemartin
 
How to test code with mruby
How to test code with mrubyHow to test code with mruby
How to test code with mrubyHiroshi SHIBATA
 
Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!cloudbring
 
[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web DesignChristopher Schmitt
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)Soshi Nemoto
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packerfrastel
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpMatthew Davis
 

Similar to Mojolicious lite (20)

Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hope
 
Mojolicious
MojoliciousMojolicious
Mojolicious
 
Baremetal deployment scale
Baremetal deployment scaleBaremetal deployment scale
Baremetal deployment scale
 
Docker, c'est bonheur !
Docker, c'est bonheur !Docker, c'est bonheur !
Docker, c'est bonheur !
 
Caching with Varnish
Caching with VarnishCaching with Varnish
Caching with Varnish
 
Dexterity in 15 minutes or less
Dexterity in 15 minutes or lessDexterity in 15 minutes or less
Dexterity in 15 minutes or less
 
PHP QA Tools
PHP QA ToolsPHP QA Tools
PHP QA Tools
 
Pyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web appsPyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web apps
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku
 
Baremetal deployment
Baremetal deploymentBaremetal deployment
Baremetal deployment
 
PSGI/Plack OSDC.TW
PSGI/Plack OSDC.TWPSGI/Plack OSDC.TW
PSGI/Plack OSDC.TW
 
Scripting for infosecs
Scripting for infosecsScripting for infosecs
Scripting for infosecs
 
How to test code with mruby
How to test code with mrubyHow to test code with mruby
How to test code with mruby
 
Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!
 
Sinatra for REST services
Sinatra for REST servicesSinatra for REST services
Sinatra for REST services
 
[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packer
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
 

More from andrefsantos

Building your own CPAN with Pinto
Building your own CPAN with PintoBuilding your own CPAN with Pinto
Building your own CPAN with Pintoandrefsantos
 
Identifying similar text documents
Identifying similar text documentsIdentifying similar text documents
Identifying similar text documentsandrefsantos
 
Poster - Bigorna, a toolkit for orthography migration challenges
Poster - Bigorna, a toolkit for orthography migration challengesPoster - Bigorna, a toolkit for orthography migration challenges
Poster - Bigorna, a toolkit for orthography migration challengesandrefsantos
 
Text::Perfide::BookCleaner, a Perl module to clean and normalize plain text b...
Text::Perfide::BookCleaner, a Perl module to clean and normalize plain text b...Text::Perfide::BookCleaner, a Perl module to clean and normalize plain text b...
Text::Perfide::BookCleaner, a Perl module to clean and normalize plain text b...andrefsantos
 
A survey on parallel corpora alignment
A survey on parallel corpora alignment A survey on parallel corpora alignment
A survey on parallel corpora alignment andrefsantos
 
Detecção e Correcção Parcial de Problemas na Conversão de Formatos
Detecção e Correcção Parcial de Problemas na Conversão de FormatosDetecção e Correcção Parcial de Problemas na Conversão de Formatos
Detecção e Correcção Parcial de Problemas na Conversão de Formatosandrefsantos
 
Bigorna - a toolkit for orthography migration challenges
Bigorna - a toolkit for orthography migration challengesBigorna - a toolkit for orthography migration challenges
Bigorna - a toolkit for orthography migration challengesandrefsantos
 

More from andrefsantos (10)

Elasto Mania
Elasto ManiaElasto Mania
Elasto Mania
 
Building your own CPAN with Pinto
Building your own CPAN with PintoBuilding your own CPAN with Pinto
Building your own CPAN with Pinto
 
Slides
SlidesSlides
Slides
 
Identifying similar text documents
Identifying similar text documentsIdentifying similar text documents
Identifying similar text documents
 
Poster - Bigorna, a toolkit for orthography migration challenges
Poster - Bigorna, a toolkit for orthography migration challengesPoster - Bigorna, a toolkit for orthography migration challenges
Poster - Bigorna, a toolkit for orthography migration challenges
 
Text::Perfide::BookCleaner, a Perl module to clean and normalize plain text b...
Text::Perfide::BookCleaner, a Perl module to clean and normalize plain text b...Text::Perfide::BookCleaner, a Perl module to clean and normalize plain text b...
Text::Perfide::BookCleaner, a Perl module to clean and normalize plain text b...
 
A survey on parallel corpora alignment
A survey on parallel corpora alignment A survey on parallel corpora alignment
A survey on parallel corpora alignment
 
Detecção e Correcção Parcial de Problemas na Conversão de Formatos
Detecção e Correcção Parcial de Problemas na Conversão de FormatosDetecção e Correcção Parcial de Problemas na Conversão de Formatos
Detecção e Correcção Parcial de Problemas na Conversão de Formatos
 
Bigorna - a toolkit for orthography migration challenges
Bigorna - a toolkit for orthography migration challengesBigorna - a toolkit for orthography migration challenges
Bigorna - a toolkit for orthography migration challenges
 
Bigorna
BigornaBigorna
Bigorna
 

Recently uploaded

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

Mojolicious lite

  • 1. Mini aplicac˜es web com ¸o Mojolicious::Lite Andr´ Santos e andrefs@cpan.org PtPW 2010 5 de Julho
  • 2. Disclaimer [Web] developer profissional
  • 3. Disclaimer [Web] developer profissional Perl::Newbie
  • 4. Disclaimer [Web] developer profissional Perl::Newbie #{coisas certas} > #{coisas erradas}
  • 7. Ruby Ruby on Rails “open source MVC web app framework” Perl
  • 8. Ruby Ruby on Rails “open source MVC web app framework” Perl Catalyst (outros)
  • 11. Ruby Sinatra pequenas aplicac˜es web ¸o Perl Mojolicious::Lite “micro web framework”
  • 12. /Mojo.*/ Mojo Mojolicious Mojolicious::Lite
  • 13. /Mojo.*/ Mojo Mojolicious Mojolicious::Lite criados por Sebastian Riedel tamb´m criador de Catalyst e developer RoR
  • 14. /Mojo.*/ .---------------------------------------------------------------. | Fun! | ’---------------------------------------------------------------’ .---------------------------------------------------------------. | | | .----------------------------------------------’ | | .--------------------------------------------. | Application | | Mojolicious::Lite | | | ’--------------------------------------------’ | | .--------------------------------------------. | | | Mojolicious | ’----------------’ ’--------------------------------------------’ .---------------------------------------------------------------. | Mojo | ’---------------------------------------------------------------’ .-------. .-----------. .--------. .------------. .-------------. | CGI | | FastCGI | | PSGI | | HTTP 1.1 | | WebSocket | ’-------’ ’-----------’ ’--------’ ’------------’ ’-------------’
  • 15. /Mojo.*/ Mojo “The box!” Encapsula as complexidades de CGI, FastCGI, PSGI, HTTP e WebSocket num s´ m´todo o e D´ suporte a frameworks web como a Mojolicious e Mojolicious::Lite
  • 16. /Mojo.*/ Mojolicious “The web in a box!” framework MVC com API OO Perl depende apenas de Perl 5.8.1
  • 17. Mojolicious::Lite Single file micro web apps framework ˜ NAO! N˜o apropriado para produc˜o, software a ¸a comercial, ...
  • 18. Mojolicious::Lite Single file micro web apps framework ˜ NAO! N˜o apropriado para produc˜o, software a ¸a comercial, ... N˜o apropriado para aplicac˜es complexas a ¸o
  • 19. Mojolicious::Lite Single file micro web apps framework ˜ NAO! N˜o apropriado para produc˜o, software a ¸a comercial, ... N˜o apropriado para aplicac˜es complexas a ¸o N˜o est´ bem documentado (ainda) a a
  • 20. $ 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.
  • 21. $ cat myapp.pl #!/usr/bin/env perl use 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>
  • 22. $ cat myapp.pl #!/usr/bin/env perl use 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>
  • 23. $ cat myapp.pl #!/usr/bin/env perl use 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>
  • 24. Routes get ’/’ => ’index’ # GET ’/’ get ’/:groovy’ => sub # GET ’/anyword’
  • 25. 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’
  • 26. 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)
  • 27. Templates Sistema de templates pr´prio; ou o Template Toolkit, ...
  • 28. Exemplos http://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)
  • 29. $ myapp.pl inflate [mkdir] ~/folder/templates/layouts [write] ~/folder/templates/layouts/funky.html. [exist] ~/folder/templates [write] ~/folder/templates/index.html.ep
  • 30. Trabalho semelhante Sinatra on Perl, github.com/jtarchie/ sinatra-on-perl Schenker, github.com/spiritloose/Schenker Dancer, perldancer.org
  • 31. Trabalho semelhante Sinatra on Perl, github.com/jtarchie/ sinatra-on-perl Schenker, github.com/spiritloose/Schenker Dancer, perldancer.org Mojolicious::Lite vs Dancer http://use.perl.org/~Alias/journal/
  • 32. Questions o/