|
IO::Mux::Handle - Virtual handle used with the L |
use IO::Mux ;
my $mux = new IO::Mux(\*SOCKET) ; my $iomh = new IO::Mux::Handle($mux) ;
open($iomh, "identifier") or die("Can't open: " . $io->get_error()) ;
print $iomh "hello\n" ;
while (<$iomh>){
print $_ ;
}
close($iomh) ;
IO::Mux::Handle objects are used to create virtual handles that are
multiplexed through an the IO::Mux manpage object.
IO::Mux::Handle that is multiplexed over the real handle
managed by IOMUX.
Since IO::Mux::Handle extends the IO::Handle manpage, most the IO::Handle manpage methods
that make sense in this context are supported. The corresponding builtins can
also be used. Errors are reported using the standard return values and
mechanisms. See below (ERROR REPORTING in the IO::Mux::Handle manpage) for more details.
Returns 1 on success or undef on error (the error message can be retreived by calling $iomh->get_error()).
IO::Mux::Handle objects,
$iomh->fileno() returns the ID identifier that was passed to $iomh->open().
While manipulating IO::Mux::Handle objects, two types of errors can occur:
IO::Mux::* module codeIO::Mux:* code itself. In this
case, $! is set to EIO if possible (see the Errno manpage for more details). If
EIO does not exists on your system, $! is set to 99999. Also, the actual
IO::Mux::* error message can be retrieved by calling $iomh->get_error().
Therefore, when working with IO::Mux::Handle objects, it is always a good
idea to check $iomh->get_error() when $! is supposed to be set, i.e.:
print $iomh "hi!\n" or die("Can't print: $! (" . $iomh->get_error() . ")") ;
the IO::Handle manpage, the IO::Mux manpage
Patrick LeBoutillier, <patl@cpan.org>
Copyright (C) 2005 by Patrick LeBoutillier
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.
|
IO::Mux::Handle - Virtual handle used with the L |