Subject: | Installs but doesn't work in Windows (Strawberry Perl) |
I got this error when using Net::Ident in windows:
your vendor has not defined POSIX macro F_SETFL
This patch seems to work for me on windows. It passes the tests, and works for the application that I am working on
the same in linux and windows with this patch. Using ->socket instead of F_SETFL may be more portable, but I've
only used it for MSWin32.
If any more details are required I'd be happy to provide them.
Thanks!
diff --git a/Ident.pm b/Ident.pm
index 31496b8..a21bc66 100644
--- a/Ident.pm
+++ b/Ident.pm
@@ -175,12 +175,16 @@ sub newFromInAddr {
bind($self->{fh}, $localbind) or die "= bind failed: $!\n";
# make it a non-blocking socket
- fcntl($self->{fh}, F_SETFL, $NONBLOCK) or die "= fcntl failed: $!\n";
+ if($^O ne 'MSWin32') {
+ fcntl($self->{fh}, F_SETFL, $NONBLOCK) or die "= fcntl failed: $!\n";
+ }
# connect it to the remote identd port, this can return EINPROGRESS.
# for some reason, reading $! twice doesn't work as it should
connect($self->{fh}, $identbind) or $!{EINPROGRESS} or
die "= connect failed: $!\n";
+
+ $self->{fh}->blocking(0) if $^O eq 'MSWin32';
};
if ( $@ =~ /^= (.*)/ ) {
# here's the catch of the throw