Event-Driven Scripting

On the program for tonight

What is the program doing now?

…It’s waiting for an event

Simple event loop

Simple event loop

That was pretty silly

Fancier event loop (1 of 4)

Fancier event loop (2 of 4)

Fancier event loop (3 of 4)

Fancier event loop (4 of 4)

Concurrency issues

Gotcha

Solution to concurrency problem?

Why a buggy example?

Reliable event loop, signals only

Wheels already invented

The Event module

Same loop, using Event

Event example, continued

POE (Perl Object Environment)

Test harness example – fe.pl

Test harness example - Sweat

The Sweat test harness

Test harness example – stress_driver

stress_driver

When to use an event loop?