summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c89d323)
raw | patch | inline | side by side (parent: c89d323)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 16 Oct 2007 23:13:35 +0000 (01:13 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Wed, 24 Oct 2007 18:03:32 +0000 (20:03 +0200) |
The "Do not initialize the Perl interpreter until loading a module."
commit removed support for adding include directories after the Perl
interpreter has been initialized. This patch re-enables it.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
commit removed support for adding include directories after the Perl
interpreter has been initialized. This patch re-enables it.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/perl.c | patch | blob | history |
diff --git a/src/perl.c b/src/perl.c
index 8c21e45c4eeca69730364d6ac6d69eca7f0b9373..c0beabfe51ca0ffd8f1b1c9f4810d0bf2e61573c 100644 (file)
--- a/src/perl.c
+++ b/src/perl.c
value = ci->values[0].value.string;
- perl_argv = (char **)realloc (perl_argv,
- (++perl_argc + 1) * sizeof (char *));
+ if (NULL == perl) {
+ perl_argv = (char **)realloc (perl_argv,
+ (++perl_argc + 1) * sizeof (char *));
- if (NULL == perl_argv) {
- log_err ("perl_config: Not enough memory.");
- exit (3);
- }
+ if (NULL == perl_argv) {
+ log_err ("perl_config: Not enough memory.");
+ exit (3);
+ }
- perl_argv[perl_argc - 1] = (char *)smalloc (strlen (value) + 3);
- sstrncpy(perl_argv[perl_argc - 1], "-I", 3);
- sstrncpy(perl_argv[perl_argc - 1] + 2, value, strlen (value) + 1);
+ perl_argv[perl_argc - 1] = (char *)smalloc (strlen (value) + 3);
+ sstrncpy(perl_argv[perl_argc - 1], "-I", 3);
+ sstrncpy(perl_argv[perl_argc - 1] + 2, value, strlen (value) + 1);
- perl_argv[perl_argc] = NULL;
+ perl_argv[perl_argc] = NULL;
+ }
+ else {
+ /* prepend the directory to @INC */
+ Perl_av_unshift (perl, GvAVn (PL_incgv), 1);
+ Perl_av_store (perl, GvAVn (PL_incgv),
+ 0, Perl_newSVpv (perl, value, strlen (value)));
+ }
return 0;
} /* static int perl_config_includedir (oconfig_item_it *) */