sub connect{ my ($self) = @_; unless($self->{_pid}) { my $host = $self->{_hostname}; my %opts = ( user => $self->{_username}, password => $self->{_password}, master_opts => [ -o => "StrictHostKeyChecking false", -o => "HashKnownHosts false" ], ); my $ssh = Net::OpenSSH->new( $host, %opts ); my ( $pty, $pid ) = $ssh->open2pty(); $self->{_pid}=$pid; $self->{_pty}=$pty; } return $self->{_pty}; }