summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3e3d0bb)
raw | patch | inline | side by side (parent: 3e3d0bb)
author | Sebastian Harl <sh@tokkee.org> | |
Sat, 17 Nov 2007 17:44:57 +0000 (18:44 +0100) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Tue, 20 Nov 2007 08:04:43 +0000 (09:04 +0100) |
Document the usage of names instead of references to identify callbacks.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/collectd-perl.pod | patch | blob | history |
diff --git a/src/collectd-perl.pod b/src/collectd-perl.pod
index b6537470de793847fcbc6424c94f3ea31591b78e..2b7766740540a51dd7731a6f0e09320155526a22 100644 (file)
--- a/src/collectd-perl.pod
+++ b/src/collectd-perl.pod
is the value passed as I<name> here and has nothing to do with the I<type>
argument which simply tells B<plugin_register> what is being registered.)
-The last argument, I<data>, is either a function- or an array-reference. If
-I<type> is B<TYPE_DATASET>, then the I<data> argument must be an
+The last argument, I<data>, is either a function name or an array-reference.
+If I<type> is B<TYPE_DATASET>, then the I<data> 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<Data-Set> above. Please note that
there is a large number of predefined data-sets available in the B<types.db>
file which are automatically registered with collectd.
If the I<type> argument is any of the other types (B<TYPE_INIT>, B<TYPE_READ>,
-...) then I<data> 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<data> 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
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.