Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Cisco Telnet

by mvip (Acolyte)
on Aug 26, 2013 at 14:25 UTC ( [id://1050969]=note: print w/replies, xml ) Need Help??


in reply to Re: Cisco Telnet
in thread Cisco Telnet

i would like if its possible to write in the log file the error form eval in this code. From "perllogrouter/router$i.log"the eval error to be put there if its possible.

eval { my $session = Net::Telnet::Cisco->new(Host => "$device", Input_log => "perllogrouter/router$i.log", ); $session->login(Password => $curpwd); if ($session->enable("$curpwd")) { # Execute a command @output = $session->cmd ('show running-config | section hostname') +; print "@output\n"; print " ======================================================\n"; } $session->close; }; if ($@) {print "Error: $@\n"}

Replies are listed 'Best First'.
Re^3: Cisco Telnet
by mvip (Acolyte) on Aug 27, 2013 at 16:18 UTC

    sorry for the noob questions but i done this. So here it is for shearing

    if ($@) { my $logtext = 'ruterproba.txt'; open my $fh, '>>',$logtext or die "Nemoze da zapise vo $logtext poradi:$! "; print $fh "Error: $@\n"}

    I dont know why i start learning perl, but i have to admit i have finish great jobs with him :)) i love it and im continuing to learn more and more :) and tnx for support .....

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1050969]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2024-04-23 10:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found