Menu

#150 perl do "/path/to/perl_module.pl arg1 arg2";

closed
None
5
2012-11-08
2007-09-22
oxo-oxo
No

Hi

Is it possible to allow args for perl do?

At the present moment, it seems like a correct way to document ones snmpd.conf with a visible showing of $regat

Best regards,
Owen Brotherwood

See extended example in:

http://www.net-snmp.org/wiki/index.php/Tut:Extending_snmpd_using_perl

Discussion

  • oxo-oxo

    oxo-oxo - 2007-09-25

    Logged In: YES
    user_id=1896547
    Originator: YES

    The example in wiki works well enough for there not to be any reason to bother about argv etc ...

     
  • oxo-oxo

    oxo-oxo - 2007-09-25

    Logged In: YES
    user_id=1896547
    Originator: YES

    except for problem that only one of these will work ...

    perl print STDERR "Perl extentsions:\n"
    perl $regat = '.1.3.6.1.4.1.8072.998'; $mibdata = '/etc/passwd'; $delimT=''; $delimV=':'; do "/etc/snmp/myext.pl";
    perl $regat = '.1.3.6.1.4.1.8072.999'; $mibdata = '/etc/group'; $delimT=''; $delimV=':'; do "/etc/snmp/myext.pl";

     
  • oxo-oxo

    oxo-oxo - 2007-09-27

    Logged In: YES
    user_id=1896547
    Originator: YES

    I need a "ping" to complete:
    http://forums.cacti.net/viewtopic.php?p=111649#111649

     
  • Dave Shield

    Dave Shield - 2007-11-16

    Logged In: YES
    user_id=88893
    Originator: NO

    In answer to the original question:
    No - it is not possible for "do FILE;" to take arguments.

    This is not a restriction of the Net-SNMP code - it is
    inherent in the behaviour of this particular perl statement.
    If you check the relevant perl documentation
    (e.g. http://perldoc.perl.org/functions/do.html\)
    you'll see that "do" takes a single argument,
    specifying the name of the file to execute.

    We can't change this behaviour ourselves - you would
    need to persuade the Perl developers to make such a change.

     

Log in to post a comment.