perl plugin: Respect the modreg flags in module_register ().
[collectd.git] / src / perl.c
index d8f294f..f42708d 100644 (file)
@@ -1064,7 +1064,7 @@ static void xs_init (pTHX)
 /*
  * Create the perl interpreter and register it with collectd.
  */
-void module_register (void)
+void module_register (modreg_e load)
 {
        char *embed_argv[] = { "", "-e", "bootstrap Collectd \""VERSION"\"", NULL };
        int  embed_argc    = 3;
@@ -1097,7 +1097,10 @@ void module_register (void)
        plugin_register_log ("perl", perl_log);
        plugin_register_config ("perl", perl_config, config_keys, config_keys_num);
        plugin_register_init ("perl", perl_init);
-       plugin_register_read ("perl", perl_read);
+
+       if (load & MR_READ)
+               plugin_register_read ("perl", perl_read);
+
        plugin_register_write ("perl", perl_write);
        plugin_register_shutdown ("perl", perl_shutdown);
        return;