Re: Behaviour of PathAdd: and LibAdd:

Steve Shipway <[email protected]>
Newsgroups gmane.network.mrtg.user
Message-ID <7294716191A1E142B80615ED2C633BCA55D5D343@uxcn10-4.UoA.auckland.ac.nz>
> > 1.       Modify MRTG_lib.pm to identify multiple use of these
> directives, and
> > push the values into @INC or $ENV{PATH} straight away, or
> >
> > 2.       Allow multiple values to be specified (possibly colon
> separated?)
> >
> 
> I would recommend #2, being consistent with LoadMibs.  In the case of
> LoadMibs, the different mibs are space separated.

I agree - space separated is better, since Windows needs colons for drive letters, and VMS as path separators.  Plus, as you say, it is more consistent with LoadMibs.  Checking the code, LoadMibs seems to support comma separated as well...

To do this, I think that around line 800 of MRTG_lib.pm, we would need something like:

    if(defined $$cfg{pathadd}){
        foreach my $p (split /[,\s]+/, $$cfg{pathadd}) {
          ensureSL(\$p);
          $ENV{PATH} = "${p}${MRTG_lib::PS}$ENV{PATH}";
        }
    }
    if(defined $$cfg{libadd}){
        foreach my $p (split /[,\s]+/, $$cfg{libadd}) {
          ensureSL(\$p);
          debug('eval',"libadd $p\n");
          local $SIG{__DIE__};
          eval "use lib qw( $p )";
        }

... to replace the existing parts.  This is very similar to the LoadMibs processing immediately above.  I've implemented it on our test server and it looks good so far.  Will probably be more work updating the documentation!

Thoughts?

Steve

Steve Shipway
ITS Unix Services Design Lead
University of Auckland, New Zealand
Floor 1, 58 Symonds Street, Auckland
Phone: +64 (0)9 3737599 ext 86487
DDI: +64 (0)9 924 6487
Mobile: +64 (0)21 753 189
Email: [email protected]
 Please consider the environment before printing this e-mail

_______________________________________________
mrtg mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg
smime.p7s (application/x-pkcs7-signature, 5.8 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.