Perl: attempting to access Expect object inside of Net::SSH::Expect gives an ERROR.
Example pseudo code:
my $m = Net::SSH::Expect->new(
host => 192.168.1.6,
user => 'root',
password => 'password',
timeout => 10,
raw_pty => 1,
log_file => '/tmp/net_ssh_expect_output.txt',
);
$m->login();
$m->expect->log_file();
This throws the error: expect():
ERROR: if called directly (not as $obj->expect(...), but as Expect::expect(...), first parameter MUST be '-i' to set an object (list) for the patterns to work on. at (eval 99)[/usr/share/perl/5.18/perl5db.pl:732] line 2.
How should I be making the call to log_file() to grab the file handle and avoid that error message?
Here is the source code which is throwing the error: Expect.pm line 492.
I expect (heh heh) to get the file handle of the log file. It looks like I am calling it as $obj->expect()
, but it throws that error. I'm probably missing something basic.