=head1 NAME

IO::Mux::File::Read - write to file

=head1 INHERITANCE

 IO::Mux::File::Read
   is a IO::Mux::Handler::Read
   is a IO::Mux::Handler

=head1 SYNOPSIS

  my $mux = IO::Mux::Select->new;  # or ::Poll

  use IO::Mux::Open '<';
  my $file = $mux->open('<', $filename);

  use IO::Mux::File::Read;
  my $file = IO::Mux::File::Read->new(file => $filename);
  $mux->add($file);

  $file->getline(sub {print "\n"});

=head1 DESCRIPTION

In an event driven program, reading is harder to use than writing: the
read will very probably be stalled until data has arrived, so you will
need a callback to handle the resulting data.

=head1 METHODS

=head2 Constructors

=over 4

=item IO::Mux::File::Read-E<gt>B<new>(OPTIONS)

 -Option   --Defined in     --Default
  exclusive                   <false>
  fh         IO::Mux::Handler  <required>
  file                        <required>
  mode                        '<'
  modeflags                   <undef>
  name       IO::Mux::Handler  '<$file'
  read_size  IO::Mux::Handler::Read  32768

=over 2

=item exclusive => BOOLEAN

=item fh => FILEHANDLE

=item file => FILENAME|HANDLE

=item mode => '<'

For now, the mode is always simply

=item modeflags => INTEGER

When defined, the C<exclusive> option is not used, but your value is
taken. Use constants defined by Fcntl.
Do not forget to include C<O_NONBLOCK>.

=item name => STRING

=item read_size => INTEGER

=back

=item IO::Mux::File::Read-E<gt>B<open>(MODE, FILE, OPTIONS)

=back

=head2 Accessors

=over 4

=item $obj-E<gt>B<fh>
See L<IO::Mux::Handler/"Accessors">

=item $obj-E<gt>B<fileno>
See L<IO::Mux::Handler/"Accessors">

=item $obj-E<gt>B<mode>

The bits of the open mode.

=item $obj-E<gt>B<mux>
See L<IO::Mux::Handler/"Accessors">

=item $obj-E<gt>B<name>
See L<IO::Mux::Handler/"Accessors">

=item $obj-E<gt>B<readSize>([INTEGER])
See L<IO::Mux::Handler::Read/"Accessors">

=item $obj-E<gt>B<usesSSL>
See L<IO::Mux::Handler/"Accessors">

=back

=head2 User interface

=head3 Connection

=over 4

=item $obj-E<gt>B<close>([CALLBACK])
See L<IO::Mux::Handler/"Connection">

=item $obj-E<gt>B<timeout>([TIMEOUT])
See L<IO::Mux::Handler/"Connection">

=back

=head3 Reading

=over 4

=item $obj-E<gt>B<readline>(CALLBACK)
See L<IO::Mux::Handler::Read/"Reading">

=item $obj-E<gt>B<slurp>(CALLBACK)
See L<IO::Mux::Handler::Read/"Reading">

=back

=head2 Multiplexer

=head3 Connection

=over 4

=item $obj-E<gt>B<mux_init>(MUX, [HANDLER])
See L<IO::Mux::Handler/"Connection">

=item $obj-E<gt>B<mux_remove>
See L<IO::Mux::Handler/"Connection">

=item $obj-E<gt>B<mux_timeout>
See L<IO::Mux::Handler/"Connection">

=back

=head3 Reading

=over 4

=item $obj-E<gt>B<mux_eof>(INPUT)
See L<IO::Mux::Handler::Read/"Reading">

=item $obj-E<gt>B<mux_except_flagged>(FILENO)
See L<IO::Mux::Handler/"Reading">

=item $obj-E<gt>B<mux_input>(BUFFER)
See L<IO::Mux::Handler::Read/"Reading">

=item $obj-E<gt>B<mux_read_flagged>(FILENO)
See L<IO::Mux::Handler/"Reading">

=back

=head3 Writing

=over 4

=item $obj-E<gt>B<mux_write_flagged>(FILENO)
See L<IO::Mux::Handler/"Writing">

=back

=head3 Service

=head2 Helpers

=over 4

=item $obj-E<gt>B<extractSocket>(HASH)

=item IO::Mux::File::Read-E<gt>B<extractSocket>(HASH)
See L<IO::Mux::Handler/"Helpers">

=item $obj-E<gt>B<fdset>(STATE, READ, WRITE, ERROR)
See L<IO::Mux::Handler/"Helpers">

=item $obj-E<gt>B<show>
See L<IO::Mux::Handler/"Helpers">

=back

=head1 SEE ALSO

This module is part of IO-Mux distribution version 0.11,
built on January 26, 2011. Website: F<http://perl.overmeer.net/>
All modules in this suite:
L</Any::Daemon>,
L</IO::Mux>, and
L</IO::Mux::HTTP>.

Please post questions or ideas to F<perl@overmeer.net>

=head1 LICENSE

Copyrights 2011 by Mark Overmeer. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

