--- AnyEvent/constants.pl.PL 2010/11/26 21:27:41 1.9 +++ AnyEvent/constants.pl.PL 2012/03/27 23:47:57 1.11 @@ -7,6 +7,7 @@ # when built as part of perl, these are not available BEGIN { eval "use Socket ()" } BEGIN { eval "use Fcntl ()" } +BEGIN { eval "use POSIX ()" } open my $fh, ">lib/AnyEvent/constants.pl" or die "lib/AnyEvent/constants.pl: $_[0]\n"; @@ -38,6 +39,22 @@ i O_NONBLOCK => eval { Fcntl::O_NONBLOCK() } || 04000; i FD_CLOEXEC => eval { Fcntl::FD_CLOEXEC() } || 1; +print "package AnyEvent::Base;\n"; + +# add these purely to avoid loading POSIX, which is slow and bloated. + +i WNOHANG => eval { POSIX::WNOHANG() } || 1; + +print "package AnyEvent::IO;\n"; + +i O_RDONLY => eval { Fcntl::O_RDONLY() } || 0; +i O_WRONLY => eval { Fcntl::O_WRONLY() } || 1; +i O_RDWR => eval { Fcntl::O_RDWR () } || 2; +i O_CREAT => eval { Fcntl::O_CREAT () } || 64; +i O_EXCL => eval { Fcntl::O_EXCL () } || 128; +i O_TRUNC => eval { Fcntl::O_TRUNC () } || 512; +i O_APPEND => eval { Fcntl::O_APPEND() } || 1024; + print "package AnyEvent::Util;\n"; # broken windows perls use undocumented error codes...