]> Dogcows Code - chaz/talk-introduction-to-psgi/blobdiff - slides.html
add slide shortcuts
[chaz/talk-introduction-to-psgi] / slides.html
index c5390b0e0c588ac1ba7fa22cfad90b07d4f023a6..61f2b9c68ed9043130856df539d16457969f131e 100644 (file)
@@ -63,7 +63,8 @@ Despite Perl's long history of powering the web, we were well behind the curve o
 
 ---
 
-class: center, middle
+class:  center, middle
+name:   psgi-flow1
 
 ## Extremely High-level Overview
 
@@ -78,7 +79,8 @@ class: center, middle
 
 ---
 
-class: center, middle
+class:  center, middle
+name:   psgi-flow2
 
 ## Pretty High-level Overview
 
@@ -92,7 +94,8 @@ class: center, middle
 
 ---
 
-class: center, middle
+class:  center, middle
+name:   psgi-flow3
 
 ## Somewhat High-level Overview
 
@@ -117,7 +120,8 @@ class: center, middle
 
 ---
 
-class: center, middle
+class:  center, middle
+name:   psgi-flow4
 
 ## Somewhat High-level Overview
 
@@ -139,7 +143,8 @@ class: center, middle
 
 ---
 
-class: center, middle
+class:  center, middle
+name:   psgi-flow5
 
 ## High-level Overview
 
@@ -149,7 +154,6 @@ class: center, middle
 
 ???
 - A web framework makes it so your app doesn't need to speak HTTP or CGI or even PSGI.
-  - 
 
 ---
 
@@ -198,7 +202,7 @@ If you're a developer writing a web app, you're probably asking why then you sho
 - New skills make you more marketable.
 
 --
-- So that you it when you see PSGI exposed through your web framework.
+- So that you understand it when you see PSGI exposed through your web framework.
 
 --
 - You can do cool things with PSGI!
@@ -224,6 +228,10 @@ layout: true
 --
 - The IETF and W3C took over standards development, resulting in [RFC 1945](https://tools.ietf.org/html/rfc1945) ("HTTP 1.0") in 1996.
 
+???
+- IETF = Internet Engineering Task Force
+- W3C = World Wide Web Consortium
+
 --
 - [RFC 2068](https://tools.ietf.org/html/rfc2068) ("HTTP 1.1") happened in 1997, superceded by [RFC 2616](https://tools.ietf.org/html/rfc2616) in 1999.
 
@@ -241,26 +249,26 @@ RFC 2616 was then superceded in 2014 by:
 
 ---
 
-.col[
+.col.marginfix[
 ### Request
 
 ```http
 GET /ip HTTP/1.1
 User-Agent: Mozilla/5.0 (X11; Linux x86_64)
-Host: foo.acme.tld
+Host: localhost
 Accept-Language: en-us
 Connection: Keep-Alive
 ```
 ]
 
-.col[
+.col.marginfix[
 ### Response
 
 ```http
 HTTP/1.1 200 OK
 Date: Thu, 07 Jul 2016 11:56:23 GMT
 Server: nginx
-Content-Length: 30
+Content-Length: 29
 Content-Type: text/plain
 Connection: Closed
 
@@ -270,26 +278,26 @@ Your IP address is 127.0.0.1.
 
 ---
 
-.col[
+.col.marginfix[
 ### Request
 
 ```http
 *GET /ip HTTP/1.1
 User-Agent: Mozilla/5.0 (X11; Linux x86_64)
-Host: foo.acme.tld
+Host: localhost
 Accept-Language: en-us
 Connection: Keep-Alive
 ```
 ]
 
-.col[
+.col.marginfix[
 ### Response
 
 ```http
 HTTP/1.1 200 OK
 Date: Thu, 07 Jul 2016 11:56:23 GMT
 Server: nginx
-Content-Length: 30
+Content-Length: 29
 Content-Type: text/plain
 Connection: Closed
 
@@ -307,26 +315,26 @@ Your IP address is 127.0.0.1.
 
 ---
 
-.col[
+.col.marginfix[
 ### Request
 
 ```http
 GET /ip HTTP/1.1
 *User-Agent: Mozilla/5.0 (X11; Linux x86_64)
-*Host: foo.acme.tld
+*Host: localhost
 *Accept-Language: en-us
 *Connection: Keep-Alive
 ```
 ]
 
-.col[
+.col.marginfix[
 ### Response
 
 ```http
 HTTP/1.1 200 OK
 Date: Thu, 07 Jul 2016 11:56:23 GMT
 Server: nginx
-Content-Length: 30
+Content-Length: 29
 Content-Type: text/plain
 Connection: Closed
 
@@ -341,26 +349,26 @@ Your IP address is 127.0.0.1.
 
 ---
 
-.col[
+.col.marginfix[
 ### Request
 
 ```http
 GET /ip HTTP/1.1
 User-Agent: Mozilla/5.0 (X11; Linux x86_64)
-Host: foo.acme.tld
+Host: localhost
 Accept-Language: en-us
 Connection: Keep-Alive
 ```
 ]
 
-.col[
+.col.marginfix[
 ### Response
 
 ```http
 HTTP/1.1 200 OK
 Date: Thu, 07 Jul 2016 11:56:23 GMT
 Server: nginx
-Content-Length: 30
+Content-Length: 29
 Content-Type: text/plain
 Connection: Closed
 
@@ -376,26 +384,26 @@ Your IP address is 127.0.0.1.
 
 ---
 
-.col[
+.col.marginfix[
 ### Request
 
 ```http
 GET /ip HTTP/1.1
 User-Agent: Mozilla/5.0 (X11; Linux x86_64)
-Host: foo.acme.tld
+Host: localhost
 Accept-Language: en-us
 Connection: Keep-Alive
 ```
 ]
 
-.col[
+.col.marginfix[
 ### Response
 
 ```http
 *HTTP/1.1 200 OK
 Date: Thu, 07 Jul 2016 11:56:23 GMT
 Server: nginx
-Content-Length: 30
+Content-Length: 29
 Content-Type: text/plain
 Connection: Closed
 
@@ -415,26 +423,26 @@ Your IP address is 127.0.0.1.
 
 ---
 
-.col[
+.col.marginfix[
 ### Request
 
 ```http
 GET /ip HTTP/1.1
 User-Agent: Mozilla/5.0 (X11; Linux x86_64)
-Host: foo.acme.tld
+Host: localhost
 Accept-Language: en-us
 Connection: Keep-Alive
 ```
 ]
 
-.col[
+.col.marginfix[
 ### Response
 
 ```http
 HTTP/1.1 200 OK
 *Date: Thu, 07 Jul 2016 11:56:23 GMT
 *Server: nginx
-*Content-Length: 30
+*Content-Length: 29
 *Content-Type: text/plain
 *Connection: Closed
 
@@ -455,26 +463,26 @@ Your IP address is 127.0.0.1.
 
 ---
 
-.col[
+.col.marginfix[
 ### Request
 
 ```http
 GET /ip HTTP/1.1
 User-Agent: Mozilla/5.0 (X11; Linux x86_64)
-Host: foo.acme.tld
+Host: localhost
 Accept-Language: en-us
 Connection: Keep-Alive
 ```
 ]
 
-.col[
+.col.marginfix[
 ### Response
 
 ```http
 HTTP/1.1 200 OK
 Date: Thu, 07 Jul 2016 11:56:23 GMT
 Server: nginx
-Content-Length: 30
+Content-Length: 29
 Content-Type: text/plain
 Connection: Closed
 
@@ -579,7 +587,7 @@ print "Your IP address is ${client_ip}.";
 
 1. Gateway sets information about the request in the environment.
 
-.condensed[
+.condensed.marginfix[
 .col[
 - `AUTH_TYPE`
 - `CONTENT_LENGTH`
@@ -604,6 +612,11 @@ print "Your IP address is ${client_ip}.";
 ]
 ]
 
+???
+- In Perl, you can get these using %ENV.
+- Or getenv from stdlib.
+- If you've done some web programming before, you're probably familiar with at least a few of these.
+
 ---
 
 ```perl
@@ -619,7 +632,7 @@ print "Your IP address is ${client_ip}.";
 1. Gateway sets information about the request in the environment.
 2. Print response headers to `STDOUT`.
 
-.condensed[
+.condensed.marginfix[
 .col[
 - `Content-Type`
 - `Location`
@@ -684,10 +697,11 @@ print "Your IP address is ${client_ip}.";
   producing correctly-formatted headers, and even producing HTML.
 - CGI.pm was deprecated in perl 5.20 and remove from core in perl 5.22.
 
-TODO make a slide for this
 Good:
 - Conceptually simple.
 - Only requires the use of the most basic and primitive program constructs (stdin, stdout, env).
+- Only other primitive construct that could have been used is that of passing program arguments.
+  - Actually, the spec does specify behavior for "search-strings" as program arguments.
 
 Bad:
 - Details can get complicated.
@@ -832,6 +846,7 @@ layout: true
 
 ???
 - Unlike the interfaces we have examined so far, mod_perl is code.
+- About the same time as FastCGI.
 
 --
 - Became an Apache Software Foundation project at ApacheCon 1999 in Orlando.
@@ -858,13 +873,16 @@ sub handler {
 ```
 
 ???
-- There's a separate mod_perl for nginx.
+- Notice how we're not using STDOUT (or even pretending to).
+- This program actually runs on a perl interpreter inside the web server.
+- It also has access to more information through the exposed API.
 
 Good:
 - Can run CGI programs as-is.
 
 Bad:
 - Can tie you to specific web servers.
+  - There's a separate mod_perl for nginx.
 - Code runs in the same process as the HTTP server -- kinda scary.
 - Using Apache's API feels heavy.
 
@@ -890,6 +908,17 @@ my $app = sub {
 };
 ```
 
+???
+- I think it's good to understand CGI et al. so that you can understand why it was designed the way
+  it was.
+- Hopefully the ideas behind PSGI are based off of the best that CGI et al. had to offer without any
+  of the drawbacks.
+
+
+- Notice how the program is a subroutine.
+- By being a subrouting rather than a script that is executed, we're already in a form that can be
+  called repeatedly without incurring fork-exec overhead. Nice!
+
 ---
 
 ```perl
@@ -911,6 +940,10 @@ my $app = sub {
 1. Hashref of request information.
 ]
 
+???
+- Oh, look! The variable is the same as is specified by CGI.
+  - Why throw away over a decade of convention?
+
 ---
 
 ```perl
@@ -938,6 +971,9 @@ my $app = sub {
 1. HTTP status code.
 ]
 
+???
+- Then you'll notice that instead of printing anything, we return an arrayref as the response.
+
 ---
 
 ```perl
@@ -1050,6 +1086,8 @@ layout: false
 
 ---
 
+class: plack
+
 ## Plack
 
 - Provides tools for building, running, and testing PSGI apps.
@@ -1196,7 +1234,7 @@ layout: true
 
 ---
 
-.condensed[
+.condensed.marginfix[
 .col[
 - `HTTP_ACCEPT`
 - `HTTP_ACCEPT_ENCODING`
@@ -1235,7 +1273,7 @@ layout: true
 
 ---
 
-.condensed[
+.condensed.marginfix[
 .col[
 - .highlight[`HTTP_ACCEPT`]
 - .highlight[`HTTP_ACCEPT_ENCODING`]
@@ -1274,7 +1312,7 @@ layout: true
 
 ---
 
-.condensed[
+.condensed.marginfix[
 .col[
 - `HTTP_ACCEPT`
 - `HTTP_ACCEPT_ENCODING`
@@ -1466,7 +1504,6 @@ name:   last
 ## Thank you
 
 Email me: Charles McGarvey
-<cmcgarvey@bluehost.com>
 <chazmcgarvey@brokenzipper.com>
 
 .talkqr.center[
@@ -1486,5 +1523,5 @@ Leave me feedback, if you want:
 ]
 ]
 
-</textarea><script src="https://gnab.github.io/remark/downloads/remark-latest.min.js"></script><script>var slideshow = remark.create({countIncrementalSlides: true, highlightLanguage: 'perl', highlightLines: true, ratio: '16:9', /*slideNumberFormat: '',*/ navigation: {scroll: false, touch: false, click: false}})</script></body></html>
+</textarea><script src="https://gnab.github.io/remark/downloads/remark-latest.min.js"></script><script>var slideshow = remark.create({countIncrementalSlides: true, highlightLanguage: 'perl', highlightLines: true, ratio: '16:9', /*slideNumberFormat: '',*/ navigation: {scroll: false, touch: false, click: false}})</script><script src="js/common.js"></script><script src="js/slides.js"></script></body></html>
 <!-- vim: set ts=4 sts=4 sw=4 tw=120 et ft=markdown nowrap: -->
This page took 0.030375 seconds and 4 git commands to generate.