3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-20 02:49:49 +01:00

Delete plugin subs /after/ calling unload()

This commit is contained in:
Pragmatic Software 2016-02-13 18:37:53 -08:00
parent f59e00e5c9
commit 8af19a75e9

View File

@ -95,9 +95,6 @@ sub load {
sub unload { sub unload {
my ($self, $plugin) = @_; my ($self, $plugin) = @_;
$self->{pbot}->{refresher}->{refresher}->unload_module("PBot::Plugins::$plugin");
$self->{pbot}->{refresher}->{refresher}->unload_subs("PBot/Plugins/$plugin.pm");
if (exists $self->{plugins}->{$plugin}) { if (exists $self->{plugins}->{$plugin}) {
eval { eval {
$self->{plugins}->{$plugin}->unload; $self->{plugins}->{$plugin}->unload;
@ -107,6 +104,10 @@ sub unload {
chomp $@; chomp $@;
$self->{pbot}->{logger}->log("Warning: got error unloading plugin $plugin: $@\n"); $self->{pbot}->{logger}->log("Warning: got error unloading plugin $plugin: $@\n");
} }
$self->{pbot}->{refresher}->{refresher}->unload_module("PBot::Plugins::$plugin");
$self->{pbot}->{refresher}->{refresher}->unload_subs("PBot/Plugins/$plugin.pm");
$self->{pbot}->{logger}->log("Plugin $plugin unloaded.\n"); $self->{pbot}->{logger}->log("Plugin $plugin unloaded.\n");
return 1; return 1;
} else { } else {