From 3005cad5c37962f788cfe12a19704f0483ae96b0 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sat, 30 Jun 2001 11:53:03 +0000 Subject: use Irssi; use Irssi::Irc and use Irssi::UI are now automatically called so you won't need to add those to scripts. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1603 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/perl/perl-common.c | 8 ++++++++ src/perl/perl.c | 10 +++++----- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'src') 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); -- cgit v1.2.3