Skip to content

Commit

Permalink
Perl Plugin: changed exec in provider 'false' case:
Browse files Browse the repository at this point in the history
perl -M${module} -e 1 does not work here because of two Problems:

1. $include_dirs is ignored
2. Collectd.pm boundled with collectd uses constants, which are set by the special perl interpreter
   build into collectds perl plugin.
   Without these constants collectd perl modules will not work.

This commit fixes both issues.
  • Loading branch information
Micha Krause committed Jan 22, 2015
1 parent 1dff045 commit 7822ba6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion manifests/plugin/perl/plugin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@
}
false: {
# this will fail if perl collectd plugin module is not installed
exec { "perl -M${module} -e 1": path => $::path }
$include_dirs_prefixed = prefix($include_dirs, '-I')
$include_dirs_prefixed_joined = join($include_dirs_prefixed,' ')
exec { "perl ${include_dirs_prefixed_joined} -e 'my\$m=shift;eval\"use \$m\";exit!exists\$INC{\$m=~s!::!/!gr.\".pm\"}' ${module}":
path => $::path
}
}
default: {
fail("Unsupported provider: ${provider}. Use 'package', 'cpan',
Expand Down

0 comments on commit 7822ba6

Please sign in to comment.