… | |
… | |
87 | |
87 | |
88 | sub register_command { |
88 | sub register_command { |
89 | my ($name, $time, $cb) = @_; |
89 | my ($name, $time, $cb) = @_; |
90 | |
90 | |
91 | my $caller = caller; |
91 | my $caller = caller; |
|
|
92 | |
|
|
93 | warn "registering command '$name/$time' to '$caller'"; |
92 | |
94 | |
93 | push @{ $command{$name} }, [$time, $cb, $caller]; |
95 | push @{ $command{$name} }, [$time, $cb, $caller]; |
94 | $COMMAND{"$name\000"} = List::Util::max map $_->[0], @{ $command{$name} }; |
96 | $COMMAND{"$name\000"} = List::Util::max map $_->[0], @{ $command{$name} }; |
95 | } |
97 | } |
96 | |
98 | |
… | |
… | |
173 | |
175 | |
174 | if ($who->flag (FLAG_WIZ)) { |
176 | if ($who->flag (FLAG_WIZ)) { |
175 | $who->message ("reloading..."); |
177 | $who->message ("reloading..."); |
176 | |
178 | |
177 | warn "reloading...\n"; |
179 | warn "reloading...\n"; |
|
|
180 | eval { |
178 | unload_extension $_ for @exts; |
181 | unload_extension $_ for @exts; |
179 | @exts = 0; |
182 | delete $INC{"cf.pm"}; |
180 | load_extensions; |
183 | |
|
|
184 | # don't, removes xs symbols, too |
|
|
185 | #Symbol::delete_package $pkg; |
|
|
186 | |
|
|
187 | require cf; |
|
|
188 | }; |
|
|
189 | warn $@ if $@; |
|
|
190 | $who->message ($@) if $@; |
181 | warn "reloaded\n"; |
191 | warn "reloaded\n"; |
182 | |
192 | |
183 | $who->message ("reloaded"); |
193 | $who->message ("reloaded"); |
184 | } else { |
194 | } else { |
185 | $who->message ("Intruder Alert!"); |
195 | $who->message ("Intruder Alert!"); |