From 3b10fcf1c9efe1ac49029c3c64ff6262047f1e0f Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Sat, 17 Nov 2007 18:44:57 +0100 Subject: [PATCH] collectd-perl(5): Updated documenation of plugin_register(). Document the usage of names instead of references to identify callbacks. Signed-off-by: Sebastian Harl Signed-off-by: Florian Forster --- src/collectd-perl.pod | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/collectd-perl.pod b/src/collectd-perl.pod index b6537470..2b776674 100644 --- a/src/collectd-perl.pod +++ b/src/collectd-perl.pod @@ -186,16 +186,22 @@ depending on the value of I. (Please note that the type of the data-set is the value passed as I here and has nothing to do with the I argument which simply tells B what is being registered.) -The last argument, I, is either a function- or an array-reference. If -I is B, then the I argument must be an +The last argument, I, is either a function name or an array-reference. +If I is B, then the I argument must be an array-reference which points to an array of hashes. Each hash describes one data-source. For the exact layout see B above. Please note that there is a large number of predefined data-sets available in the B file which are automatically registered with collectd. If the I argument is any of the other types (B, B, -...) then I is expected to be a function reference. These functions are -called in the various stages of the daemon and are passed the following +...) then I is expected to be a function name. If the name is not +prefixed with the plugin's package name collectd will add it automatically. +The interface slightly differs from the C interface (which expects a function +pointer instead) because Perl does not support to share references to +subroutines between threads. + +These functions are called in the various stages of the daemon (see the +section "WRITING YOUR OWN PLUGINS" above) and are passed the following arguments: =over 4 @@ -356,8 +362,8 @@ A very simple write function will look like: To register those functions with collectd: - plugin_register (TYPE_READ, "foobar", \&foobar_read); - plugin_register (TYPE_WRITE, "foobar", \&foobar_write); + plugin_register (TYPE_READ, "foobar", "foobar_read"); + plugin_register (TYPE_WRITE, "foobar", "foobar_write"); See the section "DATA TYPES" above for a complete documentation of the data types used by the read and write functions. -- 2.30.2