The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mojo::Run3::Util - Utilities for Mojo::Run3

SYNOPSIS

  use Mojo::Run3::Util qw(stty_set);

  my $run3 = Mojo::Run3->new(driver => {stdin => 'pty', stdout => 'pipe'});
  $run3->once(spawn => sub ($run3) {
    stty_set $run3->handle('stdin'), qw(TCSANOW -ECHO);
  });

  $run3->run_p(sub { exec qw(/usr/bin/ls -l /tmp) })->wait;

DESCRIPTION

Mojo::Run3::Util contains some utility functions that might be useful for Mojo::Run3.

EXPORTED FUNCTIONS

stty_set

  stty_set $fh, @flags;
  stty_set $fh, qw(TCSANOW -ECHO);

Used to change the POSIX termios flags for a filehandle. Instead of using "POSIX::Termios" in POSIX constants you must pass in the names of the constants instead. A minus will unset the flag.

Currently supported flags:

  Family  | Flag names
  --------|----------------------------------------------------------------------------------
  attr    | TCIFLUSH TCIOFF TCIOFLUSH TCION TCOFLUSH TCOOFF TCOON TCSADRAIN TCSAFLUSH TCSANOW
  c_cc    | VEOF VEOL VERASE VINTR VKILL VQUIT VSUSP VSTART VSTOP VMIN VTIME NCCS
  c_cflag | CLOCAL CREAD CS5 CS6 CS7 CS8 CSIZE CSTOPB HUPCL PARENB PARODD
  c_iflag | BRKINT ICRNL IGNBRK IGNCR IGNPAR INLCR INPCK ISTRIP IXOFF IXON PARMRK
  c_lflag | ECHO ECHOE ECHOK ECHONL ICANON IEXTEN ISIG NOFLSH TOSTOP
  c_oflag | OPOST

SEE ALSO

Mojo::Run3, IO::Stty, IO::Termios.