The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

UV::TTY - TTY stream handles in libuv

SYNOPSIS

  #!/usr/bin/env perl
  use strict;
  use warnings;

  # A new stream handle will be initialised against the default loop
  my $tty = UV::TTY->new(fd => 0);

  # set up the data read callback
  $tty->on(read => sub {
    my ($self, $err, $buf) = @_;
    say "More data: $buf";
  });
  $tty->read_start();

DESCRIPTION

This module provides an interface to libuv's TTY stream handle.

TTY handles represent a stream for the console.

EVENTS

UV::TTY inherits all events from UV::Stream and UV::Handle.

METHODS

UV::TTY inherits all methods from UV::Stream and UV::Handle and also makes the following extra methods available.

set_mode

    $tty->set_mode($mode);

The set_mode method sets the mode of the TTY handle, to one of the UV_TTY_MODE_* constants.

get_winsize

    my ($width, $height) = $tty->get_winsize();

The get_winsize method returns the size of the window.

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.