SlideShare a Scribd company logo
1 of 83
Download to read offline
a reviravolta do
desenvolvimento web
Wallace Reis

YAPC::BR - São Paulo/2012
eu
@wreis - wallace@reis.me
vitória.pm
yelster digital
123people.com - frontend lead-dev
123pages.fr
reporama.com
eu
@wreis - wallace@reis.me
vitória.pm
yelster digital
123people.com - frontend lead-dev
123pages.fr
reporama.com
eu
@wreis - wallace@reis.me
vitória.pm
yelster digital
123people.com - frontend lead-dev
123pages.fr
reporama.com
caótico!
...de escrever...
Catalyst

Tripletail

Noe

Maypole

Konstrukt

Schenker

Mason

Reaction

Tatsumaki

Mojo

Jifty

Amon

Sledge

Cyclone3

Apache2::WebApp

Spoon

WebGUI

Web::Simple

PageKit

OpenInteract

Apache2::REST

AxKit

Squatting

SweetPea

Egg

Dancer

Hydrant

Gantry

CGI::Application

Titanium

Continuity

Nanoa

CGI.pm

Solstice

Ark

Mojolicious

Angelos
...de executar...
CGI
FastCGI
mod_perl
standalone HTTP
CGI.pm
Jifty, CGI::Application, Spoon...
mod_perl
Mason, Sledge, PageKit...
com adaptadores
Maypole, Catalyst, Squatting...
HTTP::Engine
PSGI
Internet
PSGI
Perl Web Server Gateway Interface
Tatsuhiko Miyagawa
WSGI (Python) e Rack (Ruby)
PSGI
Perl Web Server Gateway Interface
Tatsuhiko Miyagawa
WSGI (Python) e Rack (Ruby)
PSGI
Perl Web Server Gateway Interface
Tatsuhiko Miyagawa
WSGI (Python) e Rack (Ruby)
my $app = sub {
my $env = shift;
return [
200,
[‘Content-Type’ => ‘text/plain’],
[‘Hello World’]
];
};
my $app = sub {
my $env = shift;
return [
200,
[‘Content-Type’ => ‘text/plain’],
[‘Hello World’]
];
};
my $app = sub {
my $env = shift;
return [
200,
[‘Content-Type’ => ‘text/plain’],
[‘Hello World’]
];
};
my $app = sub {
my $env = shift;
return [
200,
[‘Content-Type’ => ‘text/plain’],
[‘Hello World’]
];
};
my $app = sub {
my $env = shift;
return [
200,
[‘Content-Type’ => ‘text/plain’],
[‘Hello World’]
];
};
my $app = sub {
my $env = shift;
return [
200,
[‘Content-Type’ => ‘text/plain’],
[‘Hello World’]
];
};
my $app = sub {
my $env = shift;
return [
200,
[‘Content-Type’ => ‘text/plain’],
[‘Hello World’]
];
};
Streaming e/ou
non-blocking?
my $app = sub {
my $env = shift;
return sub {
my $respond = shift;
# ... delegar
$respond->(
[$status, $headers, $body]
);
};
};
my $app = sub {
my $env = shift;
return sub {
my $respond = shift;
my $w = $respond->([$status, $headers]);
$w->write($body);
...
$w->close;
};
};
PSGI

...
PSGI

SPDY?
Plack?
Plack?

PSGI toolkit
HTTP::Server::PSGI
Plack::Component
Plack::(Request|Response)
Plack::Middleware
220+ Middleware
my $app = sub {
my $env = shift;
return [ $status, $headers, $body ];
};
my $mw = sub { ... };
my $mw = sub {
my $env = shift;
# ...faz algo com (ou no) $env
my $res = $app->($env);
# faz algo com a (ou na) $res
return $res;
};
package My::Middleware;
use
use
use
use

strict;
warnings;
Plack::Request;
parent ‘Plack::Middleware’;

sub call {
my ( $self, $env ) = @_;
# ...faz algo com (ou no) $env
# my $req = Plack::Request->new($env);
my $res = $app->($env);
# faz algo com a (ou na, ou nova) $res
# my $res = $req->new_response;
return $res;
}
1;
Plack::Util::response_cb
$ plackup app.psgi
HTTP::Server::PSGI: Accepting connections
at http:/
/0:5000/
$ plackup -s $SERVER app.psgi
$ plackup -s FCGI app.psgi
$ plackup -s Starman app.psgi
use Plack::Builder;
my $app = MyApp->psgi_app; # ->to_psgi; ->to_app; >as_psgi; etc
builder {
enable ‘Static’, ...;
enable_if {
$_[0]->{'PATH_INFO'} =~ m{^/admin}
} 'Auth::Htpasswd', ...;
};

$app;
Plack::App
Plack::App::File
Plack::App::Directory
Plack::App::Proxy
Plack::App::FCGIDispatcher
Plack::App::URLMap
use Plack::Builder;
my $app = MyApp->psgi_app; # ->to_psgi; ->to_app; ->as_psgi; etc
builder {
enable ‘Static’, ...;
enable_if {
$_[0]->{'PATH_INFO'} =~ m{^/admin}
} 'Auth::Htpasswd', ...;
mount ‘/foo’ => $foo_app;
mount ‘http:/
/www.example.com/’ => builder {
enable ‘AccessLog’, ...;
$bar_app;
};
};

mount ‘/’ => $app;
Plack::App::CGIBin
Plack::App::WrapCGI
Plack::App::FakeApache
Plack::Test
Test::WWW::Mechanize::PSGI
25+ Frameworks e
Toolkits
35+ Webservers e
Handlers
25+ Frameworks e
Toolkits
35+ Webservers e
Handlers
CGI

Plack::Handler::CGI
mod_perl

Plack::Handler::Apache(1|2)
FastCGI
Plack::Handler::FCGI
::FCGI::EV
::FCGI::Async
::AnyEvent::FCGI
fastpass
FastCGI
Plack::Handler::FCGI
::FCGI::EV
::FCGI::Async
::AnyEvent::FCGI
fastpass
FastCGI
Plack::Handler::FCGI
::FCGI::EV
::FCGI::Async
::AnyEvent::FCGI
fastpass
Servidores HTTP
autônomos
HTTP::Server::PSGI
HTTP::Server::Simple::PSGI
Starman
Starlet
Servidores HTTP
autônomos
HTTP::Server::PSGI
HTTP::Server::Simple::PSGI
Starman
Starlet
Servidores HTTP
autônomos
HTTP::Server::PSGI
HTTP::Server::Simple::PSGI
Starman
Starlet
Servidores HTTP
autônomos
HTTP::Server::PSGI
HTTP::Server::Simple::PSGI
Starman
Starlet
Servidores HTTP
autônomos (async)
Feersum
Twiggy
Perlbal::Plugin::PSGI
mod_psgi
nginx_mod_psgi
Mongrel2
Obrigado! Perguntas?
Wallace Reis @wreis
wallace@reis.me

YAPC::BR::2012

https:/
/metacpan.org/module/PSGI
http:/
/plackperl.org/
http:/
/blog.plackperl.org/
IRC#plack

More Related Content

What's hot

Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7
Masahiro Nagano
 
Plack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and serversPlack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and servers
Tatsuhiko Miyagawa
 
Building a desktop app with HTTP::Engine, SQLite and jQuery
Building a desktop app with HTTP::Engine, SQLite and jQueryBuilding a desktop app with HTTP::Engine, SQLite and jQuery
Building a desktop app with HTTP::Engine, SQLite and jQuery
Tatsuhiko Miyagawa
 

What's hot (20)

Intro to PSGI and Plack
Intro to PSGI and PlackIntro to PSGI and Plack
Intro to PSGI and Plack
 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with Perl
 
Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7
 
Mojo as a_client
Mojo as a_clientMojo as a_client
Mojo as a_client
 
Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101
 
Plack at YAPC::NA 2010
Plack at YAPC::NA 2010Plack at YAPC::NA 2010
Plack at YAPC::NA 2010
 
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
 
Inside Bokete: Web Application with Mojolicious and others
Inside Bokete:  Web Application with Mojolicious and othersInside Bokete:  Web Application with Mojolicious and others
Inside Bokete: Web Application with Mojolicious and others
 
Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.
 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with Perl
 
Plack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and serversPlack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and servers
 
Webrtc mojo
Webrtc mojoWebrtc mojo
Webrtc mojo
 
Web Development in Perl
Web Development in PerlWeb Development in Perl
Web Development in Perl
 
Perl in the Internet of Things
Perl in the Internet of ThingsPerl in the Internet of Things
Perl in the Internet of Things
 
About Data::ObjectDriver
About Data::ObjectDriverAbout Data::ObjectDriver
About Data::ObjectDriver
 
PSGI/Plack OSDC.TW
PSGI/Plack OSDC.TWPSGI/Plack OSDC.TW
PSGI/Plack OSDC.TW
 
Lies, Damn Lies, and Benchmarks
Lies, Damn Lies, and BenchmarksLies, Damn Lies, and Benchmarks
Lies, Damn Lies, and Benchmarks
 
Modern Perl Web Development with Dancer
Modern Perl Web Development with DancerModern Perl Web Development with Dancer
Modern Perl Web Development with Dancer
 
Building a desktop app with HTTP::Engine, SQLite and jQuery
Building a desktop app with HTTP::Engine, SQLite and jQueryBuilding a desktop app with HTTP::Engine, SQLite and jQuery
Building a desktop app with HTTP::Engine, SQLite and jQuery
 
Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perl
 

Viewers also liked

Presentation劉思竹v4.2 10122608
Presentation劉思竹v4.2 10122608Presentation劉思竹v4.2 10122608
Presentation劉思竹v4.2 10122608
思竹 劉
 
Open Source Software and Free Software
Open Source Software and Free SoftwareOpen Source Software and Free Software
Open Source Software and Free Software
Dhurjati Borah
 
Case study questions_6
Case study questions_6Case study questions_6
Case study questions_6
professorsrb
 
Week10_networking_2
Week10_networking_2Week10_networking_2
Week10_networking_2
ispkosova
 
Minhyul bae Design Portfolio 2013
Minhyul bae Design Portfolio 2013Minhyul bae Design Portfolio 2013
Minhyul bae Design Portfolio 2013
Minhyul Bae
 
Miguel s anchez
Miguel s anchezMiguel s anchez
Miguel s anchez
Ja'r R'oz
 

Viewers also liked (20)

6 tips on perfect security camera system
6 tips on perfect security camera system6 tips on perfect security camera system
6 tips on perfect security camera system
 
Presentation劉思竹v4.2 10122608
Presentation劉思竹v4.2 10122608Presentation劉思竹v4.2 10122608
Presentation劉思竹v4.2 10122608
 
Open Source Software and Free Software
Open Source Software and Free SoftwareOpen Source Software and Free Software
Open Source Software and Free Software
 
My Presentation
My PresentationMy Presentation
My Presentation
 
vida saludable
vida saludablevida saludable
vida saludable
 
Higiene y seguridad industrial
Higiene y seguridad industrialHigiene y seguridad industrial
Higiene y seguridad industrial
 
Case study questions_6
Case study questions_6Case study questions_6
Case study questions_6
 
Windows 8 Presentation for Mobile 101 - Thinslices
Windows 8 Presentation for Mobile 101 - ThinslicesWindows 8 Presentation for Mobile 101 - Thinslices
Windows 8 Presentation for Mobile 101 - Thinslices
 
Actividad 1
Actividad 1Actividad 1
Actividad 1
 
Week10_networking_2
Week10_networking_2Week10_networking_2
Week10_networking_2
 
Minhyul bae Design Portfolio 2013
Minhyul bae Design Portfolio 2013Minhyul bae Design Portfolio 2013
Minhyul bae Design Portfolio 2013
 
Diapositivas sobre los origenes d ela universidad
Diapositivas sobre los origenes d ela universidadDiapositivas sobre los origenes d ela universidad
Diapositivas sobre los origenes d ela universidad
 
European union: a quick explaination
European union: a quick explainationEuropean union: a quick explaination
European union: a quick explaination
 
H6 het parlement
H6 het parlementH6 het parlement
H6 het parlement
 
Influence of Mobile Money on Transactions in Africa; Focus East Africa
Influence of Mobile Money on Transactions in Africa; Focus East AfricaInfluence of Mobile Money on Transactions in Africa; Focus East Africa
Influence of Mobile Money on Transactions in Africa; Focus East Africa
 
Miguel s anchez
Miguel s anchezMiguel s anchez
Miguel s anchez
 
Elasticsearch Quick Introduction
Elasticsearch Quick IntroductionElasticsearch Quick Introduction
Elasticsearch Quick Introduction
 
Windows Phone 8 - What's new
Windows Phone 8 - What's newWindows Phone 8 - What's new
Windows Phone 8 - What's new
 
Prelims
PrelimsPrelims
Prelims
 
Monetary_Policy_Target_Audience_Expanding_Reach_through_Tailored_Form_Content
Monetary_Policy_Target_Audience_Expanding_Reach_through_Tailored_Form_Content Monetary_Policy_Target_Audience_Expanding_Reach_through_Tailored_Form_Content
Monetary_Policy_Target_Audience_Expanding_Reach_through_Tailored_Form_Content
 

Similar to A reviravolta do desenvolvimento web

Psgi Plack Sfpm
Psgi Plack SfpmPsgi Plack Sfpm
Psgi Plack Sfpm
som_nangia
 
Psgi Plack Sfpm
Psgi Plack SfpmPsgi Plack Sfpm
Psgi Plack Sfpm
wilburlo
 
Curscatalyst
CurscatalystCurscatalyst
Curscatalyst
Kar Juan
 
Secure Coding with WordPress - WordCamp SF 2008
Secure Coding with WordPress - WordCamp SF 2008Secure Coding with WordPress - WordCamp SF 2008
Secure Coding with WordPress - WordCamp SF 2008
Mark Jaquith
 
Socket applications
Socket applicationsSocket applications
Socket applications
João Moura
 

Similar to A reviravolta do desenvolvimento web (20)

Psgi Plack Sfpm
Psgi Plack SfpmPsgi Plack Sfpm
Psgi Plack Sfpm
 
Psgi Plack Sfpm
Psgi Plack SfpmPsgi Plack Sfpm
Psgi Plack Sfpm
 
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!
 
Perl Web Client
Perl Web ClientPerl Web Client
Perl Web Client
 
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
 
Marvel of Annotation Preprocessing in Java by Alexey Buzdin
Marvel of Annotation Preprocessing in Java by Alexey BuzdinMarvel of Annotation Preprocessing in Java by Alexey Buzdin
Marvel of Annotation Preprocessing in Java by Alexey Buzdin
 
Curscatalyst
CurscatalystCurscatalyst
Curscatalyst
 
Creating Responsive Experiences
Creating Responsive ExperiencesCreating Responsive Experiences
Creating Responsive Experiences
 
I put on my mink and wizard behat (tutorial)
I put on my mink and wizard behat (tutorial)I put on my mink and wizard behat (tutorial)
I put on my mink and wizard behat (tutorial)
 
Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)
 
Perl web app 테스트전략
Perl web app 테스트전략Perl web app 테스트전략
Perl web app 테스트전략
 
Ten modules I haven't yet talked about
Ten modules I haven't yet talked aboutTen modules I haven't yet talked about
Ten modules I haven't yet talked about
 
Secure Coding with WordPress - WordCamp SF 2008
Secure Coding with WordPress - WordCamp SF 2008Secure Coding with WordPress - WordCamp SF 2008
Secure Coding with WordPress - WordCamp SF 2008
 
Blog Hacks 2011
Blog Hacks 2011Blog Hacks 2011
Blog Hacks 2011
 
Socket applications
Socket applicationsSocket applications
Socket applications
 
Forget about index.php and build you applications around HTTP!
Forget about index.php and build you applications around HTTP!Forget about index.php and build you applications around HTTP!
Forget about index.php and build you applications around HTTP!
 
Intro to Php Security
Intro to Php SecurityIntro to Php Security
Intro to Php Security
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hope
 
How to build a High Performance PSGI/Plack Server
How to build a High Performance PSGI/Plack Server How to build a High Performance PSGI/Plack Server
How to build a High Performance PSGI/Plack Server
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Recently uploaded (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
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...
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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...
 
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
 
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
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

A reviravolta do desenvolvimento web