From: Sebastian Harl Date: Sat, 17 Nov 2007 17:44:57 +0000 (+0100) Subject: collectd-perl(5): Updated documenation of plugin_register(). X-Git-Tag: collectd-4.3.0beta0~92 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3b10fcf1c9efe1ac49029c3c64ff6262047f1e0f;p=collectd.git 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 --- 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.