ChangeLog: Add missing notes about _REENTRANT and the sensors plugin.
[collectd.git] / src / perl.c
index dde34b8..0283757 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * collectd - src/perl.c
- * Copyright (C) 2007  Sebastian Harl
+ * Copyright (C) 2007, 2008  Sebastian Harl
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
@@ -831,6 +831,10 @@ static int init_pi (int argc, char **argv)
                log_err ("module_register: Unable to bootstrap Collectd.");
                exit (1);
        }
+
+       /* Set $0 to "collectd" because perl_parse() has to set it to "-e". */
+       Perl_sv_setpv (perl, Perl_get_sv (perl, "0", 0), "collectd");
+
        perl_run (perl);
 
        plugin_register_log ("perl", perl_log);
@@ -936,6 +940,11 @@ static int perl_config_includedir (oconfig_item_t *ci)
                        || (OCONFIG_TYPE_STRING != ci->values[0].type))
                return 1;
 
+       if (NULL == aTHX) {
+               log_warn ("EnableDebugger has no effects if used after LoadPlugin.");
+               return 1;
+       }
+
        value = ci->values[0].value.string;
 
        if (NULL == perl) {