Very lightly tested, and it might depend heavily on the details of the tied handle, but this approach already showed some "signs of life"
The gist is, you have to stash away the tied object before re-tieing it, and then delegate to its methods when it comes to reading and writing.
In the case of IO::Multiplex and IO::Socket::SSL that means:
In IO::Multiplex's add method, stash away the tied object before it gets steamrolled by the new tie()
sub add { [...] $self->{_fhs}{"$fh"}{oldtie} = tied(*$fh) if defined(tied(*$fh)); $self->{_handles}{"$fh"} = $fh; tie *$fh, "IO::Multiplex::Handle", $self, $fh; return $fh; }
resp.$rv = ($self->{_fhs}{"$fh"}{oldtie}) ? $self->{_fhs}{"$fh"}{oldtie}->READ($data, BUFSIZ) : &POSIX::read(fileno($fh), $data, BUFSIZ);
$rv = ($self->{_fhs}{"$fh"}{oldtie}) ? $self->{_fhs}{"$fh"}{oldtie}->READ($data, BUFSIZ) : &POSIX::read(fileno($fh), $data, BUFSIZ);
This code is in the "I-tried-it-once-and-it-seemed-to-work" category. Use with care.
Don't forget goggles and gloves.
In reply to Re^2: IO::Multiplex and tied handles?
by oldtomas
in thread IO::Multiplex and tied handles?
by oldtomas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |