sub get_file { validate_pos(@_, 1, 1); my $self = shift; my $file_path = shift; if (!$self->_file_exists($file_path)) { $self->logw("File $file_path does not exist"); $self->logt('checking file'); return ''; } my $file = RemoteFile->new({ path => $file_path, ssh => $self->connection } ); my $content = $file->read_and_delete; # disconnect/destroy the file object's ssh connection $file->disconnect; return $content; }