Pearl: how would I send router command output to a varaible and a file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Babar Farooq
    New Member
    • Aug 2010
    • 2

    Pearl: how would I send router command output to a varaible and a file

    Folks,

    I'm trying to execute a command on a router and then storing that output to a variable e.g. $output..I don't know how to do it in Pearl..Any help would be appreciated in this regard.

    Thanks
    -Babar
  • chaarmann
    Recognized Expert Contributor
    • Nov 2007
    • 785

    #2
    $output=$router->execute($AComm and);

    Comment

    • Oralloy
      Recognized Expert Contributor
      • Jun 2010
      • 988

      #3
      Babar,

      How is the script supposed to connect to the router? Serial port? Telnet? HTTP?

      Please give us some real information, if you want help.

      Cheers

      Comment

      • Babar Farooq
        New Member
        • Aug 2010
        • 2

        #4
        Thanks for the pointer....I've connected to router via telnet....This is what I used to do in TCL, but don't know how would we do in Perl..

        set output [$router exec "sh run | inc trap"]

        Thanks
        Babar

        Comment

        • Oralloy
          Recognized Expert Contributor
          • Jun 2010
          • 988

          #5
          I'd recommend the Net::Telnet.pm module. You can find it on CPAN here.

          Hopefully that gets you off the ground.

          Comment

          Working...