Mercurial > pidgin.yaz
diff plugins/perl/perl.c @ 11290:b284c703d398
[gaim-migrate @ 13490]
Did some house cleaning on the code finished up some of the "TODO" stuff
that was left over from when I originally did the XSUBs. Furthermore,
the dynamically loaded Perl package problems should be corrected now that
the context is set before one of the concurrent perl interpreters is run.
committer: Tailor Script <tailor@pidgin.im>
author | John H. Kelm <johnkelm@gmail.com> |
---|---|
date | Thu, 18 Aug 2005 01:35:14 +0000 |
parents | bb0d7b719af2 |
children | 519dc2186438 |
line wrap: on
line diff
--- a/plugins/perl/perl.c Wed Aug 17 21:42:28 2005 +0000 +++ b/plugins/perl/perl.c Thu Aug 18 01:35:14 2005 +0000 @@ -33,7 +33,6 @@ #undef PACKAGE - #define group perl_group #ifdef _WIN32 @@ -175,6 +174,8 @@ }; my_perl = perl_alloc(); + PERL_SET_CONTEXT(my_perl); + PL_perl_destruct_level = 1; perl_construct(my_perl); #ifdef DEBUG perl_parse(my_perl, xs_init, 4, perl_args, NULL); @@ -186,7 +187,6 @@ #else perl_eval_pv(perl_definitions, TRUE); /* deprecated */ #endif - perl_run(my_perl); } @@ -195,7 +195,9 @@ { if (my_perl == NULL) return; - + + PL_perl_destruct_level = 1; + PERL_SET_CONTEXT(my_perl); perl_eval_pv( "foreach my $lib (@DynaLoader::dl_modules) {" "if ($lib =~ /^Gaim\\b/) {" @@ -205,6 +207,8 @@ "}", TRUE); + PL_perl_destruct_level = 1; + PERL_SET_CONTEXT(my_perl); perl_destruct(my_perl); perl_free(my_perl); my_perl = NULL; @@ -226,13 +230,17 @@ { /* XXX This would be much faster if I didn't create a new * PerlInterpreter every time I probed a plugin */ + PerlInterpreter *prober = perl_alloc(); char *argv[] = {"", plugin->path }; gboolean status = TRUE; HV *plugin_info; - + PERL_SET_CONTEXT(prober); + PL_perl_destruct_level = 1; perl_construct(prober); + perl_parse(prober, xs_init, 2, argv, NULL); + perl_run(prober); plugin_info = perl_get_hv("PLUGIN_INFO", FALSE); @@ -367,9 +375,10 @@ } } + PL_perl_destruct_level = 1; + PERL_SET_CONTEXT(prober); perl_destruct(prober); perl_free(prober); - return status; } @@ -390,10 +399,12 @@ plugin->handle = gps; atmp[1] = gps->package; - + + PERL_SET_CONTEXT(my_perl); execute_perl("Gaim::PerlLoader::load_n_eval", 2, atmp); { + PERL_SET_CONTEXT(my_perl); dSP; ENTER; SAVETMPS; @@ -423,6 +434,7 @@ static void destroy_package(const char *package) { + PERL_SET_CONTEXT(my_perl); dSP; ENTER; @@ -454,6 +466,7 @@ if (gps->unload_sub != NULL) { + PERL_SET_CONTEXT(my_perl); dSP; ENTER; SAVETMPS;