Author image Cameron Tauxe
and 1 contributors

NAME

Term::Scroller::Linefeed - Utility function for Term::Scroller, used to read lines from a pseudoterminal, allowing for non-terminated lines.

SYNOPSIS

    use IO::Pty;
    use Term::Scroller::Linefeed qw(linefeed);

    my $pty = IO::Pty->new();

    # (Set up something to write to the $pty however you like)

    while( my $line = linefeed($pty) ) {

        if ($line =~ /\n$/) {
            print "Pty printed a complete line"
        }
        else {
            print "Pty printed a partial line"
        }

    }

DESCRIPTION

This module exports the linefeed function which takes an IO::Pty instance and returns the next line of text from read from the slave. The key difference between this (as opposed to simply '<$pty->slave>') is that it will not wait for a newline character at the end of input. So if a sequence of text not ending in a newline is written to the pty master, then it will be available immediately as a "line" returned by this function.

NOTE: This stores an internal buffer of lines alongside the IO::Pty instance, adding an arrayref 'term_scroller_linefeed' in the Pty's typeglob.