… | |
… | |
158 | |
158 | |
159 | sub load_extensions { |
159 | sub load_extensions { |
160 | my $LIBDIR = maps_directory "perl"; |
160 | my $LIBDIR = maps_directory "perl"; |
161 | |
161 | |
162 | for my $ext (<$LIBDIR/*.ext>) { |
162 | for my $ext (<$LIBDIR/*.ext>) { |
|
|
163 | next unless -r $ext; |
|
|
164 | eval { |
163 | load_extension $ext; |
165 | load_extension $ext; |
|
|
166 | 1 |
|
|
167 | } or warn "$ext not loaded: $@"; |
164 | } |
168 | } |
165 | } |
169 | } |
166 | |
170 | |
167 | register_command "perl-reload", 0, sub { |
171 | register_command "perl-reload", 0, sub { |
168 | my ($who, $arg) = @_; |
172 | my ($who, $arg) = @_; |
169 | |
173 | |
170 | if ($who->flag (FLAG_WIZ)) { |
174 | if ($who->flag (FLAG_WIZ)) { |
|
|
175 | $who->message ("reloading..."); |
|
|
176 | |
171 | warn "reloading...\n"; |
177 | warn "reloading...\n"; |
172 | unload_extension $_ for @exts; |
178 | unload_extension $_ for @exts; |
173 | @exts = 0; |
179 | @exts = 0; |
174 | load_extensions; |
180 | load_extensions; |
175 | warn "reloaded\n"; |
181 | warn "reloaded\n"; |
|
|
182 | |
|
|
183 | $who->message ("reloaded"); |
|
|
184 | } else { |
|
|
185 | $who->message ("Intruder Alert!"); |
176 | } |
186 | } |
177 | }; |
187 | }; |
178 | |
188 | |
179 | load_extensions; |
189 | load_extensions; |
180 | |
190 | |