AnyEvent
view release on metacpan or search on metacpan
constants.pl.PL view on Meta::CPAN
#! perl
# this file is unfortunately only executed at Makefile.PL time
my ($fh, $oldstdout);
BEGIN {
open $fh, ">lib/AnyEvent/constants.pl"
or die "lib/AnyEvent/constants.pl: $!\n";
$oldstdout = select $fh;
print "# automatically generated from constants.pl.PL\n";
}
{
# from common::sense 3.74
use strict qw(vars subs);
no warnings;
use warnings qw(FATAL closed threads internal debugging pack malloc portable prototype
inplace io pipe unpack glob digit printf
layer reserved taint closure semicolon);
no warnings qw(exec newline unopened);
BEGIN {
print "sub AnyEvent::common_sense {\n";
printf " local \$^W;\n";
printf " \${^WARNING_BITS} ^= \${^WARNING_BITS} ^ \"%s\";\n",
join "", map "\\x$_", unpack "(H2)*", ${^WARNING_BITS};
# use strict, use utf8;
printf " \$^H |= 0x%x;\n", $^H;
print "}\n";
}
}
use Config;
print "# generated for perl $] built for $Config{archname}\n";
# when built as part of perl, these are not available
BEGIN { eval "use Socket ()" }
BEGIN { eval "use Fcntl ()" }
BEGIN { eval "use POSIX ()" }
sub i($$) {
print "sub $_[0](){", $_[1]*1, "}\n";
}
sub n($$) {
print "sub $_[0](){", (defined $_[1] ? $_[1]*1 : "undef"), "}\n";
}
print "package AnyEvent;\n";
our $WIN32 = $^O =~ /mswin32/i;
# used a lot
i CYGWIN => $^O =~ /cygwin/i;
i WIN32 => $WIN32;
# add these purely to avoid loading Fcntl, which is slow and bloated.
i F_SETFD => eval { Fcntl::F_SETFD() } || 2;
i F_SETFL => eval { Fcntl::F_SETFL() } || 4;
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;
( run in 1.230 second using v1.01-cache-2.11-cpan-39bf76dae61 )