Re: PATCH: generic watchers with dataful events
[email protected] (Joshua N Pritikin) Sun, 05 Dec 2004 15:53:33 +0530
| Newsgroups | perl.loop |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 2004-12-01 at 01:23 +0000, Zefram wrote: > +=head1 SYNOPSIS > + > + use Event::generic; > + > + $source = Event::generic::Source->new; > + > + $w = Event->generic(source => $source, ...); > + $w = $source->watch(...); > + > + $source = $w->source; > + $w->source($source); > + > + @watchers = $source->active_watchers; > + > + $source->event; > + $source->event($data); > + > + $data = $event->data; What is the point of the Event::generic::Source class? It seems like there is only one really important method in the class -- "event" to create a new event. So what I'm thinking is why not just add this method to the generic watcher class? Wouldn't that simplify things? The usage above just seems big and clunky, over-engineered perhaps. For example, how about only: $w = Event->generic(); $w->create_event([qw(a b c)]); warn $event->data->[1]; # b ?
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQBBsuGlqcqnlKSmC70RAvNrAJ9juWJVIBKnQPanJPrvC8jfKvhB0QCgtf4M bobw1vn3oEgTQEHgHrzhLEY= =qRQw -----END PGP SIGNATURE-----