rajuskark has asked for the wisdom of the Perl Monks concerning the following question:

use lib '/opt/vyatta/share/perl5'; use lib '/opt/vyatta/sbin/'; use lib '/opt/vyatta/config/'; use Data::Dumper; use Vyatta::Config; $ENV{PATH} = "$ENV{PATH}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr +/bin:/sbin:/bin"; $ENV{RUN}="/opt/vyatta/bin/vyatta-op-cmd-wrapper"; my $path = $ENV{'PATH'}; $config = new Vyatta::Config; $config->setLevel("interfaces ethernet eth0"); $config->inSession(); my @c = $config->listNodes(); foreach my $i ( @c ){ print $i,"\n"; }
calling cfgPathGetChildNodes() without config session at /opt/vyatta/share/perl5/Vyatta/Config.pm
Kishor

Replies are listed 'Best First'.
Re: Vyos with perl
by GotToBTru (Prior) on Oct 05, 2016 at 14:37 UTC

    For the benefit of onlookers: see http://wiki.vyos.net/wiki/Perl_API.

    You might perhaps test to make sure your new instance is being created successfully.

    But God demonstrates His own love toward us, in that while we were yet sinners, Christ died for us. Romans 5:8 (NASB)

      How to execute vyos command in perl script? Please give any suggestion if anyone had.
      Kishor
        I want to execute vyos basic commands through perl script using PERL API , can you please tell me the how to do it
        Kishor
Re: Vyos with perl
by stevieb (Canon) on Oct 05, 2016 at 13:17 UTC

    The module you're referring to is not on the CPAN, so if you want us to help, you'll have to either show us the module here, or place a link to it. We're but humble Monks, not magicians that can guess at what's wrong with code we can't see :)

      https://raw.githubusercontent.com/vyos/vyatta-cfg/current/lib/Vyatta/C +onfig.pm
      Kishor
Re: Vyos with perl
by rajuskark (Acolyte) on Oct 05, 2016 at 13:09 UTC
    I got error msg: calling cfgPathGetChildNodes() without config session at /opt/vyatta/s +hare/perl5/Vyatta/Config.pm
    Kishor