perl plugin: Added 'flush' fallback
[collectd.git] / bindings / perl / lib / Collectd.pm
index 576e5f4..7e89e45 100644 (file)
@@ -180,13 +180,13 @@ sub plugin_call_all {
        }
 
        if (TYPE_LOG != $type) {
-               DEBUG ("Collectd::plugin_call: type = \"$type\" ("
+               DEBUG ("Collectd::plugin_call_all: type = \"$type\" ("
                        . $types{$type} . "), args=\""
                        . join(', ', map { defined($_) ? $_ : '<undef>' } @_) . "\"");
        }
 
        if (! defined $plugins[$type]) {
-               ERROR ("Collectd::plugin_call: unknown type \"$type\"");
+               ERROR ("Collectd::plugin_call_all: unknown type \"$type\"");
                return;
        }
 
@@ -296,6 +296,9 @@ sub plugin_register {
                        return plugin_register_notification($name, $data);
                }
                if (TYPE_FLUSH == $type) {
+                       #For collectd-5.6 only
+                       lock %{$plugins[$type]};
+                       $plugins[$type]->{$name} = $data;
                        return plugin_register_flush($name, $data);
                }
                lock %{$plugins[$type]};