Event::generic(3)
π NAME π
Event::generic β generic event handling. Thatβs the whole vibe, bestie. β¨
This is the Event::generic(3) page from the User Contributed Perl Documentation, so you already know itβs gonna be a little niche and a little iconic. π«Ά
β¨ SYNOPSIS β¨
use Event::generic;
$source = Event::generic::Source->new;
$w = Event->generic(source => $source, ...);
$w = $source->watch(...);
$source = $w->source;
$w->source($source);
$source->event;
$source->event($data);
$data = $event->data;
πΈ DESCRIPTION πΈ
Okay so this module gives you a watcher type inside the Event framework. But real talk: you must understand the architecture of the Event system before this document will make sense β no skipping the lore, bestie. π
It gives you a system of reified event sources and watchers watching those sources. Events are generated solely by a method on the event source object. Those events may carry arbitrary data to the event handler callbacks. This module is intended for situations where the events of interest are best determined by Perl code. Itβs giving βlet Perl decide what counts as an event,β and honestly? Slay. π
π CLASSES π
Event::generic::Sourceβ a reified event source. The source of the source, if you will. β¨Event::genericβ a watcher that can watchEvent::generic::Sourceevent sources. πEvent::Event::Datafulβ a (target) event that can carry arbitrary data. Dataful and booked. π
π EVENT SOURCE CLASS π
π§ Constructor π§
Event::generic::Source->newβ creates and returns a new event source. Fresh source, no cap. π«Ά
π Methods π
$source->event$source->event(DATA)
Invoking this method is a source event for watchers of the event source. When this method is called, each active watcher of the event source generates a target event. The DATA, if supplied, is copied into the target event objects, from which it can be retrieved using the data() method. Like passing a little note in class β except the note is arbitrary data and the class is event handling. π
$source->watch(ATTR => VALUE, ...)β generates and returns a new watcher, configured to watch this event source. The standard watcher attributes may be specified as arguments. The watcher returned is an ordinaryEvent::generic, and may be reconfigured to watch a different event source. Reusable watcher? We love a flexible icon. π
π₯ WATCHER CLASS π₯
π Type-specific attributes π
source => $sourceβ the event source to watch. This must be either anEvent::generic::Sourceobject orundef. When set toundef, no source is being watched, and the watcher cannot be started. So if you set it toundef, itβs literally not beating the βcanβt startβ allegations. π
β EVENT CLASS β
π Type-specific methods π
$event->dataβ returns the data associated with the event, which may be any scalar. This is read-only, and is set by the event source. So no take-backs, bestie; the source already decided. π
π SEE ALSO π
Eventβ the main character, obviously. π
Later, bestie! π This page is from perl v5.42.0, dated 2021-04-30 β Event::generic(3), mwah. πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Event 1.28-bp160.1.14 Β· Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-Event 1.28-bp160.1.14 Β· Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-Event 1.28-bp160.1.14 Β· Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-Event 1.28-bp160.1.14 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms