Re: LWPng on Windows NT
Gisle Aas (gisle@aas.no)
02 Jul 1998 21:16:51 +0200
Blair Zajac <blair@gps.caltech.edu> writes:
> Has anybody run LWPng on Windows NT?
I have not.
> I've been running into some
> problems where spooled requests to LWP::UA are not handled and
> mainloop->empty returns true.
The following code (from LWP::Conn::HTTP) is probably not portable
enough? The rest of the socket stuff and the LWP::EventLoop ought to
work.
# A hack that should work at least on systems with POSIX.pm. It
# implements the constant EINPROGRESS and IO::Handle->blocking;
# XXX: When we require IO-1.18, then this hack can be removed.
require IO::Handle;
unless (defined &IO::EINPROGRESS) {
my $einprogress = -1;
eval {
require POSIX;
$einprogress = &POSIX::EINPROGRESS;
};
$! = $einprogress;
die "No EINPROGRESS found ($!)" if ($@ or $! ne "Operation now in progress")
;
*IO::EINPROGRESS = sub () { $einprogress; };
# we also emulate $handle->blocking call provided by newer versions of
# the IO modules
require Fcntl;
my $O_NONBLOCK = Fcntl::O_NONBLOCK();
my $F_GETFL = Fcntl::F_GETFL();
my $F_SETFL = Fcntl::F_SETFL();
*IO::Handle::blocking = sub {
my $fh = shift;
my $dummy = '';
my $old = fcntl($fh, $F_GETFL, $dummy);
return undef unless defined $old;
if (@_) {
my $new = $old;
if ($_[0]) {
$new &= ~$O_NONBLOCK;
} else {
$new |= $O_NONBLOCK;
}
fcntl($fh, $F_SETFL, $new);
}
($old & $O_NONBLOCK) == 0;
}
}
This code might not be triggered if the IO module update on CPAN is
installed. Anybody know the status of IO-1.19 on WinNT?
Regards,
Gisle