summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6106b14)
raw | patch | inline | side by side (parent: 6106b14)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 22 Apr 2007 20:57:43 +0000 (22:57 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Mon, 23 Apr 2007 13:29:05 +0000 (15:29 +0200) |
"IncludeDir <Dir>" adds <Dir> to the @INC array.
A segfault when parsing unknown config options has been fixed and documentation
about the perl plugin has been added to collectd.conf.pod.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
A segfault when parsing unknown config options has been fixed and documentation
about the perl plugin has been added to collectd.conf.pod.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
src/collectd.conf.in | patch | blob | history | |
src/collectd.conf.pod | patch | blob | history | |
src/perl.c | patch | blob | history |
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index 4cfa694a2be8ce328b1658e06d7d91a3ff65f05a..2986edf3769e5eb78acf195446b2c40b93bcd036 100644 (file)
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
#</Plugin>
#<Plugin perl>
+# IncludeDir "/my/include/path"
# BaseName "Collectd::Plugin"
# LoadPlugin foo
#</Plugin>
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index da50a346b9d7df78903e72f125ae74df28796ee1..32f74cd7f8b044e82883d3e19b9f9a7bf058ae48 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
=back
+=head2 Plugin C<perl>
+
+=over 4
+
+=item B<LoadPlugin> I<Plugin>
+
+Loads the Perl plugin I<Plugin>. This does basically the same as B<use> would
+do in a Perl program.
+
+=item B<BaseName> I<Name>
+
+Prepends I<Name>B<::> to all plugin names loaded after this option. This is
+provided for convenience to keep plugin names short.
+
+=item B<IncludeDir> I<Dir>
+
+Adds I<Dir> to the B<@INC> array. This is the same as using the B<-IDir>
+command line option or B<use lib Dir> in the source code.
+
+=back
+
=head2 Plugin C<ping>
=over 4
diff --git a/src/perl.c b/src/perl.c
index f42708d7dde81cff2d8d811f66d0a3e2eda8e781..c9977496dc95b1ea11e742ed290c6b6fbb157ce2 100644 (file)
--- a/src/perl.c
+++ b/src/perl.c
{
"LoadPlugin",
"BaseName",
- NULL
+ "IncludeDir"
};
static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
strncpy (base_name, value, sizeof (base_name));
base_name[sizeof (base_name) - 1] = '\0';
}
+ else if (0 == strcasecmp (key, "IncludeDir")) {
+ Perl_av_unshift (perl, GvAVn (PL_incgv), 1);
+ Perl_av_store (perl, GvAVn (PL_incgv),
+ 0, Perl_newSVpv (perl, value, strlen (value)));
+ }
else {
return -1;
}