… | |
… | |
169 | |
169 | |
170 | sub unload_extension { |
170 | sub unload_extension { |
171 | my ($pkg) = @_; |
171 | my ($pkg) = @_; |
172 | |
172 | |
173 | warn "removing extension $pkg\n"; |
173 | warn "removing extension $pkg\n"; |
|
|
174 | |
|
|
175 | if (my $cb = $pkg->can ("on_unload")) { |
|
|
176 | $cb->($pkg); |
|
|
177 | } |
174 | |
178 | |
175 | # remove hooks |
179 | # remove hooks |
176 | for my $idx (0 .. $#EVENT) { |
180 | for my $idx (0 .. $#EVENT) { |
177 | delete $hook[$idx]{$pkg}; |
181 | delete $hook[$idx]{$pkg}; |
178 | } |
182 | } |
… | |
… | |
222 | |
226 | |
223 | unload_extension $_ for @exts; |
227 | unload_extension $_ for @exts; |
224 | delete $INC{"cf.pm"}; |
228 | delete $INC{"cf.pm"}; |
225 | |
229 | |
226 | # don't, removes xs symbols, too |
230 | # don't, removes xs symbols, too |
227 | #Symbol::delete_package $pkg; |
231 | #Symbol::delete_package __PACKAGE__; |
228 | |
232 | |
229 | require cf; |
233 | require cf; |
230 | }; |
234 | }; |
231 | warn $@ if $@; |
235 | warn $@ if $@; |
232 | $who->message ($@) if $@; |
236 | $who->message ($@) if $@; |