1Event::generic(3) User Contributed Perl Documentation Event::generic(3)
2
3
4
6 Event::generic - generic event handling
7
9 use Event::generic;
10
11 $source = Event::generic::Source->new;
12
13 $w = Event->generic(source => $source, ...);
14 $w = $source->watch(...);
15
16 $source = $w->source;
17 $w->source($source);
18
19 $source->event;
20 $source->event($data);
21
22 $data = $event->data;
23
25 This module provides a watcher type within the "Event" framework. You
26 must understand the architecture of the "Event" system in order to
27 understand this document.
28
29 This module provides a system of reified event sources and watchers
30 watching those sources. Events are generated solely by a method on the
31 event source object. The events may carry arbitrary data to the event
32 handler callbacks. This module is intended for situations where the
33 events of interest are best determined by Perl code.
34
36 Event::generic::Source
37 A reified event source.
38
39 Event::generic
40 A watcher that can watch "Event::generic::Source" event sources.
41
42 Event::Event::Dataful
43 A (target) event that can carry arbitrary data.
44
46 Constructor
47 Event::generic::Source->new
48 Creates and returns a new event source.
49
50 Methods
51 $source->event
52 $source->event(DATA)
53 The invocation of this method is a source event for watchers of the
54 event source. When this method is called, each active watcher of
55 the event source generates a target event. The DATA, if supplied,
56 is copied into the target event objects, from which it can be
57 retrieved using the "data()" method.
58
59 $source->watch(ATTR => VALUE, ...)
60 Generates and returns a new watcher, configured to watch this event
61 source. The standard watcher attributes may be specified as
62 arguments. The watcher returned is an ordinary "Event::generic",
63 and may be reconfigured to watch a different event source.
64
66 Type-specific attributes
67 source => $source
68 The event source to watch. This must be either an
69 "Event::generic::Source" object or "undef". When set to "undef",
70 no source is being watched, and the watcher cannot be started.
71
73 Type-specific methods
74 $event->data
75 Returns the data associated with the event, which may be any
76 scalar. This is read-only, and is set by the event source.
77
79 Event
80
81
82
83perl v5.32.0 2020-07-28 Event::generic(3)