From 7cbe751a390fcc3d81d6f1e627213cb2983e27b4 Mon Sep 17 00:00:00 2001 From: "roberto@natty32" Date: Mon, 2 May 2011 17:12:32 +0200 Subject: [PATCH] added --perl-local-lib --- plugins/psgi/psgi.h | 2 ++ plugins/psgi/psgi_plugin.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/plugins/psgi/psgi.h b/plugins/psgi/psgi.h index a614ca81..6c62d84c 100644 --- a/plugins/psgi/psgi.h +++ b/plugins/psgi/psgi.h @@ -14,6 +14,7 @@ struct uwsgi_perl { int fd; char *psgibuffer; char *psgi; + char *locallib; PerlInterpreter *main; pthread_key_t u_interpreter; PerlInterpreter **interp; @@ -26,6 +27,7 @@ struct uwsgi_perl { #define LONG_ARGS_PERL_BASE 17000 + ((5 + 1) * 1000) #define LONG_ARGS_PSGI LONG_ARGS_PERL_BASE + 1 +#define LONG_ARGS_PERL_LOCAL_LIB LONG_ARGS_PERL_BASE + 2 void init_perl_embedded_module(void); int psgi_response(struct wsgi_request *, PerlInterpreter *, AV*); diff --git a/plugins/psgi/psgi_plugin.c b/plugins/psgi/psgi_plugin.c index 9a80a561..2bad878b 100644 --- a/plugins/psgi/psgi_plugin.c +++ b/plugins/psgi/psgi_plugin.c @@ -8,6 +8,7 @@ struct uwsgi_perl uperl; struct option uwsgi_perl_options[] = { {"psgi", required_argument, 0, LONG_ARGS_PSGI}, + {"perl-local-lib", required_argument, 0, LONG_ARGS_PERL_LOCAL_LIB}, {0, 0, 0, 0}, }; @@ -142,6 +143,12 @@ int uwsgi_perl_init(){ PL_origalen = 1; perl_parse(uperl.main, xs_init, 4, embedding, NULL); + if (uperl.locallib) { + char *ll = uwsgi_concat3("use local::lib '", uperl.locallib, "' ;"); + uwsgi_log("using %s as local::lib directory\n", uperl.locallib); + perl_eval_pv(ll, 0); + free(ll); + } perl_eval_pv("use IO::Handle;", 0); perl_eval_pv("use IO::File;", 0); @@ -536,6 +543,9 @@ int uwsgi_perl_manage_options(int i, char *optarg) { case LONG_ARGS_PSGI: uperl.psgi = optarg; return 1; + case LONG_ARGS_PERL_LOCAL_LIB: + uperl.locallib = optarg; + return 1; } return 0;