package UV::TTY;

our $VERSION = '2.000';

use strict;
use warnings;
use Carp ();
use parent 'UV::Stream';

sub _new_args {
    my ($class, $args) = @_;
    my $fd = delete $args->{fd} // delete $args->{single_arg};
    return ($class->SUPER::_new_args($args), $fd);



=encoding utf8

=head1 NAME

UV::TTY - TTY stream handles in libuv


  #!/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";


This module provides an interface to
L<libuv's TTY|> stream handle.

TTY handles represent a stream for the console.

=head1 EVENTS

L<UV::TTY> inherits all events from L<UV::Stream> and L<UV::Handle>.

=head1 METHODS

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

=head2 set_mode


The L<set_mode|>
method sets the mode of the TTY handle, to one of the C<UV_TTY_MODE_*>

=head2 get_winsize

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

The L<get_winsize|>
method returns the size of the window.

=head1 AUTHOR

Paul Evans <>

=head1 LICENSE

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