ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/constants.pl.PL
(Generate patch)

Comparing AnyEvent/constants.pl.PL (file contents):
Revision 1.10 by root, Sun Dec 5 11:41:45 2010 UTC vs.
Revision 1.14 by root, Wed Aug 21 08:40:28 2013 UTC

1#! perl 1#! perl
2 2
3# this file is unfortunately only executed at Makefile.PL time 3# this file is unfortunately only executed at Makefile.PL time
4 4
5my ($fh, $oldstdout);
6
7BEGIN {
8 open $fh, ">lib/AnyEvent/constants.pl"
9 or die "lib/AnyEvent/constants.pl: $!\n";
10
11 $oldstdout = select $fh;
12
13 print "# automatically generated from constants.pl.PL\n";
14}
15
16{
17 # from common::sense 3.7
18 use strict qw(vars subs);
19 no warnings;
20 use warnings qw(FATAL closed threads internal debugging pack malloc portable prototype
21 inplace io pipe unpack deprecated glob digit printf
22 layer reserved taint closure semicolon);
23 no warnings qw(exec newline unopened);
24
25 BEGIN {
26 print "sub AnyEvent::common_sense {\n";
27 printf " local \$^W;\n";
28 printf " \${^WARNING_BITS} ^= \${^WARNING_BITS} ^ \"%s\";\n",
29 join "", map "\\x$_", unpack "(H2)*", ${^WARNING_BITS};
30 # use strict, use utf8;
31 printf " \$^H |= 0x%x;\n", $^H;
32 print "}\n";
33 }
34}
35
5use Config; 36use Config;
37
38print "# generated for perl $] built for $Config{archname}\n";
6 39
7# when built as part of perl, these are not available 40# when built as part of perl, these are not available
8BEGIN { eval "use Socket ()" } 41BEGIN { eval "use Socket ()" }
9BEGIN { eval "use Fcntl ()" } 42BEGIN { eval "use Fcntl ()" }
10BEGIN { eval "use POSIX ()" } 43BEGIN { eval "use POSIX ()" }
11
12open my $fh, ">lib/AnyEvent/constants.pl"
13 or die "lib/AnyEvent/constants.pl: $_[0]\n";
14
15my $oldstdout = select $fh;
16
17print "# automatically generated from constants.pl.PL for perl $] built for $Config{archname}\n";
18 44
19sub i($$) { 45sub i($$) {
20 print "sub $_[0](){", $_[1]*1, "}\n"; 46 print "sub $_[0](){", $_[1]*1, "}\n";
21} 47}
22 48
42print "package AnyEvent::Base;\n"; 68print "package AnyEvent::Base;\n";
43 69
44# add these purely to avoid loading POSIX, which is slow and bloated. 70# add these purely to avoid loading POSIX, which is slow and bloated.
45 71
46i WNOHANG => eval { POSIX::WNOHANG() } || 1; 72i WNOHANG => eval { POSIX::WNOHANG() } || 1;
73
74print "package AnyEvent::IO;\n";
75
76i O_RDONLY => eval { Fcntl::O_RDONLY() } || 0;
77i O_WRONLY => eval { Fcntl::O_WRONLY() } || 1;
78i O_RDWR => eval { Fcntl::O_RDWR () } || 2;
79i O_CREAT => eval { Fcntl::O_CREAT () } || 64;
80i O_EXCL => eval { Fcntl::O_EXCL () } || 128;
81i O_TRUNC => eval { Fcntl::O_TRUNC () } || 512;
82i O_APPEND => eval { Fcntl::O_APPEND() } || 1024;
47 83
48print "package AnyEvent::Util;\n"; 84print "package AnyEvent::Util;\n";
49 85
50# broken windows perls use undocumented error codes... 86# broken windows perls use undocumented error codes...
51if ($WIN32) { 87if ($WIN32) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines