diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/perl/perl-common.c | 8 | ||||
-rw-r--r-- | src/perl/perl.c | 10 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c index b004b9e6..781cd9b8 100644 --- a/src/perl/perl-common.c +++ b/src/perl/perl-common.c @@ -21,6 +21,7 @@ #include "module.h" #include "modules.h" #include "signals.h" +#include "core.h" #include "misc.h" #include "settings.h" @@ -156,6 +157,13 @@ char *perl_get_use_list(void) str = g_string_new(NULL); + if (*PERL_LIB_DIR != '\0') + g_string_append(str, "use lib \""PERL_LIB_DIR"\";"); + + g_string_append(str, "use Irssi;"); + if (irssi_gui != IRSSI_GUI_NONE) + g_string_append(str, "use Irssi::UI;"); + for (tmp = use_protocols; tmp != NULL; tmp = tmp->next) g_string_sprintfa(str, "use Irssi::%s;", (char *) tmp->data); diff --git a/src/perl/perl.c b/src/perl/perl.c index 4a766282..9fbab064 100644 --- a/src/perl/perl.c +++ b/src/perl/perl.c @@ -94,12 +94,12 @@ static void irssi_perl_start(void) perl_parse(my_perl, xs_init, 3, args, NULL); - use_code = *PERL_LIB_DIR == '\0' ? "" : - "use lib \""PERL_LIB_DIR"\";"; - + use_code = perl_get_use_list(); code = g_strdup_printf(eval_file_code, use_code); perl_eval_pv(code, TRUE); - g_free(code); + + g_free(code); + g_free(use_code); perl_common_init(); } @@ -249,7 +249,7 @@ static void cmd_perl(const char *data) code = g_string_new(NULL); uses = perl_get_use_list(); - g_string_sprintf(code, "sub { use Irssi;%s\n%s }", uses, data); + g_string_sprintf(code, "sub { %s\n%s }", uses, data); sv = perl_eval_pv(code->str, TRUE); perl_call_sv(sv, G_VOID|G_NOARGS|G_EVAL|G_DISCARD); |