mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-20 10:59:29 +01:00
Plugins/Plang: Plang can now be refreshed live
This commit is contained in:
parent
622f949d9b
commit
20bc7c52e6
@ -19,17 +19,17 @@ use Getopt::Long qw(GetOptionsFromArray);
|
|||||||
sub initialize {
|
sub initialize {
|
||||||
my ($self, %conf) = @_;
|
my ($self, %conf) = @_;
|
||||||
|
|
||||||
# load Plang module
|
# load Plang modules
|
||||||
my $path = $self->{pbot}->{registry}->get_value('general', 'plang_dir') // 'Plang';
|
my $path = $self->{pbot}->{registry}->get_value('general', 'plang_dir') // 'Plang';
|
||||||
unshift @INC, $path if not grep { $_ eq $path } @INC;
|
unshift @INC, $path if not grep { $_ eq $path } @INC;
|
||||||
require "$path/Interpreter.pm";
|
|
||||||
|
|
||||||
# allow !refresh to reload these modules
|
# require all the Plang .pm modules so Module::Refresh can reload them without
|
||||||
$self->{pbot}->{refresher}->{refresher}->update_cache("$path/Interpreter.pm");
|
# needing to restart PBot
|
||||||
$self->{pbot}->{refresher}->{refresher}->update_cache("$path/AstInterpreter.pm");
|
require "$path/Interpreter.pm";
|
||||||
$self->{pbot}->{refresher}->{refresher}->update_cache("$path/Grammar.pm");
|
require "$path/AstInterpreter.pm";
|
||||||
$self->{pbot}->{refresher}->{refresher}->update_cache("$path/Lexer.pm");
|
require "$path/Grammar.pm";
|
||||||
$self->{pbot}->{refresher}->{refresher}->update_cache("$path/Parser.pm");
|
require "$path/Parser.pm";
|
||||||
|
require "$path/Lexer.pm";
|
||||||
|
|
||||||
# regset plang.debug 0-10 -- Plugin must be reloaded for this value to take effect.
|
# regset plang.debug 0-10 -- Plugin must be reloaded for this value to take effect.
|
||||||
my $debug = $self->{pbot}->{registry}->get_value('plang', 'debug') // 0;
|
my $debug = $self->{pbot}->{registry}->get_value('plang', 'debug') // 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user