<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Hi!<DIV><BR class="khtml-block-placeholder"></DIV><DIV>I promised to start this discussion, so apologies for not doing it earlier.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I think Nagios::Plugin is at a state where it is good enough to start using for the plugins in distribution. The main question is: how?</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>The current utils.pm has problems because of the parsing of the location of this module. We want to fix this so it is not an issue with N::P.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>If N::P is installed in the perl system libraries, no paths need changing. If N::P is installed elsewhere, the perl plugins need to know where to find N::P.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><DIV><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>I think it comes down to two choices:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>1. Expect N::P to be installed from an external mechanism, either manually installed via CPAN, or using a OS specific package. We'd have to make sure the Nagios Plugins requires these packages (amend various spec files, update REQUIREMENTS file, etc)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>2. Install N::P (and other dependent perl modules) in a (./configure chosen) location.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>(1) is easier, though it pushes responsibility onto packagers. As N::P and the perl scripts in Nagios Plugins are updated, there is a dependency on packagers to make the newer version available for us to require on.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>(2) is harder, though we would have control over what versions are recommended.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Ideally we need to support both, so that packagers can include only the minimum software required for Nagios Plugins, but a "direct install" case will still work for most users.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>My proposal is this:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>./configure has two new options: --enable-local-perl-modules, --disable-local-perl-modules. The default is to search for N::P and enable if not found or disable if found.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>--disable-local-perl-modules does nothing beyond current</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>--enable-local-perl-modules will install N::P from a new top level subdirectory I'm calling "nanocpan". In this directory is the tar file from CPAN for N::P plus all the dependent perl modules. At make time, a "perl Makefile.PL PREFIX=$prefix" (and some other options that I'm not too sure of right now) and "make" will be run to compile all the required perl modules - this will be recursive, so other dependent perl modules will be included. At make install time, those perl modules will be installed into, say, $prefix/lib.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>All perl scripts that require N::P will have 'use FindBin qw($Bin); use lib "$Bin/../lib"; use Nagios::Plugin'. This means that the script will expect to find N::P in $prefix/lib - unfortunately there is a limitation that the libexec/ directory needs to reside in the same dir as lib/. </DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>If N::P is not installed in $prefix/lib, then the standard perl system libraries will be searched. If they aren't found there, then the script should fail (return code 2 on my perl 5.8.4).</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>As newer versions of N::P are developed, we can include them in the nagiosplug distribution. If more dependent plugins are needed, those could just be dropped into the nanocpan/ directory.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>So I think the work is:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>  a) amend configure scripts</DIV><DIV>  b) develop some "nanocpan" system where a directory holds all the possible perl modules that may be needed</DIV><DIV>  c) develop some "nanocpan-install" script where it installs a specified perl module (in our case, N::P) and recursively installs dependent ones if required (hopefully, this will be similar to already developed CPAN code)</DIV><DIV>  d) amend existing perl scripts to expect N::P in $Bin/../lib</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I'm not aware of anything like (b) and (c), but would welcome enlightenment if there is. Otherwise I can see a "nanocpan" system being useful for other projects besides Nagios Plugins, that we can contribute back to the perl community.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Opinions?</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>BTW, if you have any doubts about why we should use perl modules, can I point you to this lightning talk presentation I gave at FOSDEM in Feburary: <A href="http://nagiosplugins.org/index.php?option=com_docman&task=cat_view&gid=28&Itemid=28">http://nagiosplugins.org/index.php?option=com_docman&task=cat_view&gid=28&Itemid=28</A></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Ton</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><A href="http://www.altinity.com">http://www.altinity.com</A></DIV><DIV>T: +44 (0)870 787 9243</DIV><DIV>F: +44 (0)845 280 1725</DIV><DIV>Skype: tonvoon</DIV></SPAN></SPAN></SPAN></SPAN></SPAN><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></DIV></BODY></HTML>