<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">Term::termios
============

termios routines for Rakudo Perl 6

    use Term::termios;
    
    # Save the previous attrs
    my $saved_termios := Term::termios.new(fd =&gt; 1).getattr;
    
    # Get the existing attrs in order to modify them
    my $termios := Term::termios.new(fd =&gt; 1).getattr;
    
    # Set the tty to raw mode
    $termios.makeraw;
    
    # You could also do the same in the old-fashioned way
    $termios.unset_iflags(&lt;BRKINT ICRNL ISTRIP IXON&gt;);
    $termios.set_oflags(&lt;ONLCR&gt;);
    $termios.set_cflags(&lt;CS8&gt;);
    $termios.unset_lflags(&lt;ECHO ICANON IEXTEN ISIG&gt;);
    
    # Set the modified atributes, delayed until the buffer is emptied
    $termios.setattr(:DRAIN);
    
    # Loop on characters from STDIN
    loop {
        my $c = $*IN.getc;
        print "got: " ~ $c.ord ~ "\r\n";
        last if $c eq 'q';
    }
    
    # Restore the saved, previous attributes before exit
    $saved_termios.setattr(:DRAIN);

See the manpage termios(3) for information about the flags.
</pre></body></html>