This suggestion is interesting, but only causes more questions :-) Most of my Events are created like such:
package Stuff;
use strict;
use Event;
sub new {
my $class = shift;
my $self = {};
$self->{args} = [@_];
bless $self, $class;
$self->{event} = Event->timer(
interval => 1,
cb => [$self, "read"],
);
return $self;
}
sub read {
my $self = shift;
my $e = shift;
# do work that uses values from $self
}
I see that $self and the {event} are technically a circular reference, but since I only create one instance of Stuff, it should not be a source of ongoing leaks. Is there something else I'm missing under the covers of Event? |