]> Dogcows Code - chaz/talk-event-driven-programming-in-perl/commitdiff
add reactor usage example
authorCharles McGarvey <cmcgarvey@bluehost.com>
Sun, 17 Jun 2018 23:17:06 +0000 (17:17 -0600)
committerCharles McGarvey <cmcgarvey@bluehost.com>
Sun, 17 Jun 2018 23:17:06 +0000 (17:17 -0600)
css/common.css
css/slides.css
img/helpdesk.jpg [new file with mode: 0644]
slides.html

index 525370d1033eb7bec8dc88fed373953e041dd5f5..8689442aabc3add73c68486c289ea07fd5adac0f 100644 (file)
@@ -94,6 +94,9 @@
 .big {
     font-size: 150%;
 }
 .big {
     font-size: 150%;
 }
+.small {
+    font-size: 50%;
+}
 
 .remark-code-line-highlighted {
     background-color: rgba(200,200,255,.25);
 
 .remark-code-line-highlighted {
     background-color: rgba(200,200,255,.25);
index e32cb1075e2989c7e69965062ca489da0b3b9e44..eb366c3b177756aaecf1ff211e075b7364c3d753 100644 (file)
     font-size: 34px;
 }
 
     font-size: 34px;
 }
 
-.ex-basicreactor .perl {
+.ex-basicreactor1 .perl {
+    font-size: 36px;
+}
+
+.ex-basicreactor2 .perl {
     font-size: 38px;
 }
 
     font-size: 38px;
 }
 
diff --git a/img/helpdesk.jpg b/img/helpdesk.jpg
new file mode 100644 (file)
index 0000000..ecfb881
Binary files /dev/null and b/img/helpdesk.jpg differ
index 51f91018b47b58dc661ea16ec0f31ef6e68920f0..8904bd24addaf2a9151822c1795c18636db47498 100644 (file)
@@ -70,6 +70,16 @@ At it's core, event-driven programming is this simple.
 
 But there are some complications and things to knows, which is why this talk exists.
 
 
 But there are some complications and things to knows, which is why this talk exists.
 
+---
+class: center, middle
+
+![Help desk](img/helpdesk.jpg)
+
+.small[
+Image by Soniachat8.
+This image is licensed under the [Creative Commons Attribution-Share Alike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/deed.en) license.
+]
+
 ---
 name:  graph-eventloop
 class: center, middle
 ---
 name:  graph-eventloop
 class: center, middle
@@ -378,9 +388,13 @@ class: syscalls
 - [`clock_gettime`](http://man.he.net/man2/clock_gettime) - What time is it now?
 
 ---
 - [`clock_gettime`](http://man.he.net/man2/clock_gettime) - What time is it now?
 
 ---
+class: center, middle
 
 ## Reactor pattern
 
 
 ## Reactor pattern
 
+---
+## Reactor pattern
+
 .big[
 - Queues events asynchronously.
 - Demultiplexes and dispatches synchronously.
 .big[
 - Queues events asynchronously.
 - Demultiplexes and dispatches synchronously.
@@ -395,9 +409,26 @@ class: center, middle
 ![Reactor](img/reactor.svg)
 
 ---
 ![Reactor](img/reactor.svg)
 
 ---
-class: ex-basicreactor
+class: ex-basicreactor1
 
 
-## The basic reactor
+## Using a reactor
+
+```perl
+my $reactor = My::Reactor->new;
+
+# Set up event handlers
+$reactor->slurp_file($filepath, \&handle_slurp_event);
+$reactor->timer(5, \&handle_timer_event);
+$reactor->listen($socket, \&handle_new_connect_event);
+...
+
+$reactor->run_loop;
+```
+
+---
+class: ex-basicreactor2
+
+## The basic reactor implementation
 
 ```perl
 our $timers     = [...];
 
 ```perl
 our $timers     = [...];
@@ -414,9 +445,9 @@ while (1) {
 ```
 
 ---
 ```
 
 ---
-class: ex-basicreactor
+class: ex-basicreactor2
 
 
-## The basic reactor
+## The basic reactor implementation
 
 ```perl
 our $timers     = [...];
 
 ```perl
 our $timers     = [...];
@@ -445,6 +476,10 @@ while (1) {
 - [`Mojo::Reactor::Poll`](https://metacpan.org/source/Mojo::Reactor::Poll)
 ]
 
 - [`Mojo::Reactor::Poll`](https://metacpan.org/source/Mojo::Reactor::Poll)
 ]
 
+???
+These links, which will be available to you with the slides, link directly to the source code of these modules on
+metacpan so you can take a look at how they work.
+
 ---
 name:  not-all-roses
 class: center, middle
 ---
 name:  not-all-roses
 class: center, middle
This page took 0.032104 seconds and 4 git commands to generate.