NAME

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

INHERITANCE

IO::Mux::File::Write
  is a IO::Mux::Handler::Write
  is a IO::Mux::Handler

SYNOPSIS

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

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

use IO::Mux::File::Write;
my $file = IO::Mux::File::Write->new
  (file => $filename, mode => '>>');
$mux->add($file);

$file->write($text);
$file->print($text);

write $file $text;
print $file $text;

DESCRIPTION

Open a file to be written.

METHODS

Constructors

IO::Mux::File::Write->new(OPTIONS)
-Option    --Defined in     --Default
 append                       <false>
 create                       <true>
 exclusive                    <false>
 fh          IO::Mux::Handler  <required>
 file                         <required>
 mode                         '>'
 modeflags                    <undef>
 name        IO::Mux::Handler  '$mode$file'
 write_size  IO::Mux::Handler::Write  4096
append => BOOLEAN
create => BOOLEAN
exclusive => BOOLEAN
fh => FILEHANDLE
file => FILENAME|HANDLE

The file to be managed, either provided as FILENAME or as HANDLE. When a HANDLE is passed, most other options will be ignored. The HANDLE must be in non-blocking mode already and opened for writing (only).

mode => '>'|'>>'

The &gt;&gt; is short for normal open plus the append option set.

modeflags => INTEGER

When defined, the mode, exclusive, create and append options are not used, but your value is taken. Use constants defined by Fcntl. Do not forget to include O_NONBLOCK.

name => STRING
write_size => INTEGER
IO::Mux::File::Write->open(MODE, FILE, OPTIONS)

Accessors

$obj->fh See "Accessors" in IO::Mux::Handler
$obj->fileno See "Accessors" in IO::Mux::Handler
$obj->mode

The bits of the open mode.

$obj->mux See "Accessors" in IO::Mux::Handler
$obj->name See "Accessors" in IO::Mux::Handler
$obj->usesSSL See "Accessors" in IO::Mux::Handler
$obj->writeSize([INTEGER]) See "Accessors" in IO::Mux::Handler::Write

User interface

Connection

$obj->close([CALLBACK]) See "Connection" in IO::Mux::Handler
$obj->timeout([TIMEOUT]) See "Connection" in IO::Mux::Handler

Writing

$obj->print(STRING|SCALAR|LIST|ARRAY) See "Writing" in IO::Mux::Handler::Write
$obj->printf(FORMAT, PARAMS) See "Writing" in IO::Mux::Handler::Write
$obj->say(STRING|SCALAR|LIST|ARRAY) See "Writing" in IO::Mux::Handler::Write
$obj->write(SCALAR, [MORE]) See "Writing" in IO::Mux::Handler::Write

Multiplexer

Connection

$obj->mux_init(MUX, [HANDLER]) See "Connection" in IO::Mux::Handler
$obj->mux_remove See "Connection" in IO::Mux::Handler
$obj->mux_timeout See "Connection" in IO::Mux::Handler

Reading

$obj->mux_except_flagged(FILENO) See "Reading" in IO::Mux::Handler
$obj->mux_read_flagged(FILENO) See "Reading" in IO::Mux::Handler

Writing

$obj->mux_outbuffer_empty See "Writing" in IO::Mux::Handler::Write
$obj->mux_output_waiting See "Writing" in IO::Mux::Handler::Write
$obj->mux_write_flagged(FILENO) See "Writing" in IO::Mux::Handler

Service

Helpers

$obj->extractSocket(HASH)
IO::Mux::File::Write->extractSocket(HASH) See "Helpers" in IO::Mux::Handler
$obj->fdset(STATE, READ, WRITE, ERROR) See "Helpers" in IO::Mux::Handler
$obj->show See "Helpers" in IO::Mux::Handler

SEE ALSO

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

Please post questions or ideas to perl@overmeer.net

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 http://www.perl.com/perl/misc/Artistic.html