use strict; use warnings; use Net::Appliance::Session; my $host = 'host'; my $user = 'username'; my $pass = 'password'; my $s = Net::Appliance::Session->new({ personality => 'cisco', transport => 'SSH', host => $host, do_paging => 0 }); try { $s->connect({ username => $user, password => $pass }); $s->begin_privileged({ password => $pass }); print $s->cmd('show clock'); $s->end_privileged; } catch { warn "Failed to execute command: $_"; } finally { $s->close; }; #### Net::CLI::Interact::ActionSet { Parents Moo::Object public methods (11) : apply_params, BUILDARGS, clone, current_match, default_continuation, DOES, execute, has_current_match, has_default_continuation, new, register_callback private methods (6) : _callbacks, _do_exec, _forward_continuation_to_match, _has_callbacks, _marshall_responses, _pad_send_with_match internals: { _callbacks [], current_match [ [0] [Pp]assword\s*:\s*$ ], _position -1, _sequence [ [0] Net::CLI::Interact::Action { Parents Moo::Object public methods (12) : BUILDARGS, clone, continuation, new, no_ors, num_params, params, prompt_hit, response, response_stash, type, value private methods (0) internals: { no_ors 0, params [], response "", response_stash "", type "send", value " " } }, [1] Net::CLI::Interact::Action { Parents Moo::Object public methods (12) : BUILDARGS, clone, continuation, new, no_ors, num_params, params, prompt_hit, response, response_stash, type, value private methods (0) internals: { no_ors 0, params [], prompt_hit var{current_match}[0], response "password: ", response_stash "", type "match", value var{current_match} } } ] } }