Skip to content

Instantly share code, notes, and snippets.

@leedo
Created March 24, 2012 16:08
Show Gist options
  • Save leedo/2184656 to your computer and use it in GitHub Desktop.
Save leedo/2184656 to your computer and use it in GitHub Desktop.
sub cleanup {
my $cv = AE::cv;
for my $irc ($self->ircs) {
$cv->begin;
$irc->reg_cb(disconnect => sub { $cv->end });
$irc->disconnect;
}
for my $plugin ($self->plugins) {
$cv->begin;
$plugin->shutdown(sub { $cv->end });
}
my $t = AE::timer 5, 0, sub {
$cv->croak("timeout shutting down plugins");
};
$cv->recv;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment