Rex::He...::Expect(3)

πŸ“¦ version 1.14.3, in nixos 26.05, nixpkgs unstable

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