Rex::He...::Expect(3)
hiii bestie π welcome to the manual page for Rex::Helper::SSH2::Expect, aka Rex::He...::Expect(3) from the User Contributed Perl Documentation. buckle up, we're doing Unix group-chat style π«Ά
πΈ NAME πΈ
Rex::Helper::SSH2::Expect β An Expect like module for Net::SSH2 π
π DESCRIPTION π
okay so this module gives you expect like features for Net::SSH2 β¨ this is the first version of this module (first-version energy fr fr), and bugs go to GitHub: https://github.com/krimdomu/net-ssh2-expect ππ
π¦ DEPENDENCIES π¦
Net::SSH2β yep, that's the one, bestie π
β¨ SYNOPSIS β¨
use Rex::Helper::SSH2::Expect;
my $exp = Rex::Helper::SSH2::Expect->new($ssh2);
$exp->spawn("passwd");
$exp->expect($timeout, [
qr/Enter new UNIX password:/ => sub {
my ($exp, $line) = @_;
$exp->send($new_password);
}
],
[
qr/Retype new UNIX password:/ => sub {
my ($exp, $line) = @_;
$exp->send($new_password);
}
],
[
qr/passwd: password updated successfully/ => sub {
my ($exp, $line) = @_;
$exp->hard_close;
}
]);
π CLASS METHODS π
these are the methods, bestie β no cap, they're all here π
π± new($ssh2)
Constructor: you need to parse an connected Net::SSH2 Object. π
π log_stdout(0|1)
Log on STDOUT. turn it on with 0 or 1, and it logs on STDOUT β¨
π log_file($file)
Log everything to a file. $file can be a filename, a filehandle or a subRef. π
π spawn($command, @parameters)
Spawn $command with @parameters as parameters. π₯
π soft_close()
Currently only an alias to hard_close(); β that's the whole vibe rn π«Ά
π hard_close();
Stops the execution of the process. periodt. π
π₯ expect($timeout, @match_patters)
This method controls the execution of your process. yes, @match_patters is spelled exactly like that β iykyk π
π send($string)
Send a string to the running command. slay. π
mwah π this page was brought to you by perl v5.42.3, dated 2023-08-05, and it lives at Rex::He...::Expect(3). bye bestie, go make expect stuff happen π«Άβ¨
π¦ where this page comes from
- nixos 26.05: perl5.42.3-Rex 1.14.3
- nixpkgs unstable: perl5.42.3-Rex 1.14.3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms