From e9a895bf42ef9b706aba2d2770ae61dad28ea9a4 Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Sun, 17 Jun 2018 17:17:06 -0600 Subject: [PATCH] add reactor usage example --- css/common.css | 3 +++ css/slides.css | 6 +++++- img/helpdesk.jpg | Bin 0 -> 13788 bytes slides.html | 43 +++++++++++++++++++++++++++++++++++++++---- 4 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 img/helpdesk.jpg diff --git a/css/common.css b/css/common.css index 525370d..8689442 100644 --- a/css/common.css +++ b/css/common.css @@ -94,6 +94,9 @@ .big { font-size: 150%; } +.small { + font-size: 50%; +} .remark-code-line-highlighted { background-color: rgba(200,200,255,.25); diff --git a/css/slides.css b/css/slides.css index e32cb10..eb366c3 100644 --- a/css/slides.css +++ b/css/slides.css @@ -44,7 +44,11 @@ font-size: 34px; } -.ex-basicreactor .perl { +.ex-basicreactor1 .perl { + font-size: 36px; +} + +.ex-basicreactor2 .perl { font-size: 38px; } diff --git a/img/helpdesk.jpg b/img/helpdesk.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ecfb881933ece0a49bd412c374ec698b15c0d0d6 GIT binary patch literal 13788 zcmch72UL?u*YJY~t|+pI^ro`HDguj0k*X_2q`iprrt}bFr1!GAi_~Nl=_LvRQbI&X z0vJH0!~g*y5K5>CJq8H9^9Rem`@ZLE|9AfLPtJMfX6DY!ojZ5tmYMzj{W0LjoBD?O z02><{aEJ8+_9?)1;0Ol?C&%F7w<8yqer>;d44?3E5t7%EW|G)C@LXy zMpXQqxS-Hk`LpMKJ}-MwR^+sTlEQ^cG8beo9CX5V}+R&L%eM4ylneTfGEHQ9Aalt`_II|$$t3Ap@YgBKe8&>4zY1?as9w~ z=ny*#hwTviVO|c-lV=po`OaRu>*M?6MaBD5{Fg4@a{29P*Z2_uDJA7!Z@>9T<+`8$ zqU*yC%ySlbte%8e3_0M*-x3@9p~I}2)4Z%=c7R2~U-fKdE%!-oSu3BD=RsVOe=>IL1Y?9?Pq03?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BC(SJ`;lRsN5_e|*Y(AMiiPk7q{ZxGd8KtIuzJ1EeHR15F3mhx?@K z{SfVNZ+;~LA+|Huv*bJ<-3V{9DvHAD#Cpr@1Lx|>craBX%U@hFe&8_h|6FvQjbWx- z$&||Dt#WT)H28Ia3pLfK^%(;S;-*#62c|!l4cFR#GPVD_m~|gHZG+obE9Z**2K<2k z2q+#jU_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 = [...]; @@ -414,9 +445,9 @@ while (1) { ``` --- -class: ex-basicreactor +class: ex-basicreactor2 -## The basic reactor +## The basic reactor implementation ```perl our $timers = [...]; @@ -445,6 +476,10 @@ while (1) { - [`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 -- 2.45.2