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
48 Event::generic::Source->new
49 Creates and returns a new event source.
50
51 Methods
52
53 $source->event
54 $source->event(DATA)
55 The invocation of this method is a source event for watchers of the
56 event source. When this method is called, each active watcher of
57 the event source generates a target event. The DATA, if supplied,
58 is copied into the target event objects, from which it can be
59 retrieved using the "data()" method.
60
61 $source->watch(ATTR => VALUE, ...)
62 Generates and returns a new watcher, configured to watch this event
63 source. The standard watcher attributes may be specified as argu‐
64 ments. The watcher returned is an ordinary "Event::generic", and
65 may be reconfigured to watch a different event source.
66
68 Type-specific attributes
69
70 source => $source
71 The event source to watch. This must be either an
72 "Event::generic::Source" object or "undef". When set to "undef",
73 no source is being watched, and the watcher cannot be started.
74
76 Type-specific methods
77
78 $event->data
79 Returns the data associated with the event, which may be any
80 scalar. This is read-only, and is set by the event source.
81
83 Event
84
85
86
87perl v5.8.8 2007-05-22 Event::generic(3)