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

I need to send the input into a log file the code below does not seem to be working.
my $s = Net::Appliance::Session->new({ personality => 'ios', transport => 'SSH', Input_log => 'input.log', Timeout => 15, host => $ip, });
Thanks I tried
#!/usr/bin/perl use Net::Appliance::Session; my $s = Net::Appliance::Session->new({ personality => 'ios', transport => 'SSH', host => $HOST, privileged_paging => 1, # only if using ASA/PIX OS 7+ # and there are other behaviour options, +see below }); try { $s->connect({ username => 'XXXXX', password => 'XXXXXXX' }); $s->begin_privileged; print $s->cmd('show ver'); $s->end_privileged; } catch { warn "failed to execute command: $_"; } finally { $s->close; };
I got
$ perl getasrrun.pl failed to execute command: read timed-out at /usr/local/share/perl/5.1 +4.2/Net/CLI/Interact/Transport/Wrapper/Net_Telnet.pm line 35 Execution of finally() block CODE(0xa17c388) resulted in an exception, + which *CAN NOT BE PROPAGATED* due to fundamental limitations of Perl +. Your program will continue as if this event never took place. Origi +nal exception text follows: read timed-out at /usr/local/share/perl/5.14.2/Net/CLI/Interact/Transp +ort/Wrapper/Net_Telnet.pm line 35

Replies are listed 'Best First'.
Re: net::appliance::session Help
by toolic (Bishop) on Mar 10, 2014 at 19:03 UTC
    The SYNOPSIS from the POD of Net::Appliance::Session shows how to get more information when it "does not seem to be working":
    try { $s->connect({ username => 'username', password => 'loginpass' }); $s->begin_privileged({ password => 'privilegedpass' }); print $s->cmd('show access-list'); $s->end_privileged; } catch { warn "failed to execute command: $_"; } finally { $s->close; };

    See also the Basic debugging checklist