ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent.pm
(Generate patch)

Comparing AnyEvent/lib/AnyEvent.pm (file contents):
Revision 1.210 by root, Wed May 13 15:19:43 2009 UTC vs.
Revision 1.214 by root, Mon Jun 22 11:57:05 2009 UTC

1=head1 NAME 1=head1 NAME
2 2
3AnyEvent - provide framework for multiple event loops 3AnyEvent - provide framework for multiple event loops
4 4
5EV, Event, Glib, Tk, Perl, Event::Lib, Qt, POE - various supported event loops 5EV, Event, Glib, Tk, Perl, Event::Lib, Qt and POE are various supported
6event loops.
6 7
7=head1 SYNOPSIS 8=head1 SYNOPSIS
8 9
9 use AnyEvent; 10 use AnyEvent;
10 11
930no warnings; 931no warnings;
931use strict qw(vars subs); 932use strict qw(vars subs);
932 933
933use Carp; 934use Carp;
934 935
935our $VERSION = 4.41; 936our $VERSION = 4.411;
936our $MODEL; 937our $MODEL;
937 938
938our $AUTOLOAD; 939our $AUTOLOAD;
939our @ISA; 940our @ISA;
940 941
941our @REGISTRY; 942our @REGISTRY;
942 943
943our $WIN32; 944our $WIN32;
944 945
945BEGIN { 946BEGIN {
946 my $win32 = ! ! ($^O =~ /mswin32/i); 947 eval "sub WIN32(){ " . (($^O =~ /mswin32/i)*1) ." }";
947 eval "sub WIN32(){ $win32 }"; 948 eval "sub TAINT(){ " . (${^TAINT}*1) . " }";
949
950 delete @ENV{grep /^PERL_ANYEVENT_/, keys %ENV}
951 if ${^TAINT};
948} 952}
949 953
950our $verbose = $ENV{PERL_ANYEVENT_VERBOSE}*1; 954our $verbose = $ENV{PERL_ANYEVENT_VERBOSE}*1;
951 955
952our %PROTOCOL; # (ipv4|ipv6) => (1|2), higher numbers are preferred 956our %PROTOCOL; # (ipv4|ipv6) => (1|2), higher numbers are preferred
1141 AnyEvent::Util::fh_nonblocking ($SIGPIPE_W) if $SIGPIPE_W; # just in case 1145 AnyEvent::Util::fh_nonblocking ($SIGPIPE_W) if $SIGPIPE_W; # just in case
1142 } else { 1146 } else {
1143 pipe $SIGPIPE_R, $SIGPIPE_W; 1147 pipe $SIGPIPE_R, $SIGPIPE_W;
1144 fcntl $SIGPIPE_R, &Fcntl::F_SETFL, &Fcntl::O_NONBLOCK if $SIGPIPE_R; 1148 fcntl $SIGPIPE_R, &Fcntl::F_SETFL, &Fcntl::O_NONBLOCK if $SIGPIPE_R;
1145 fcntl $SIGPIPE_W, &Fcntl::F_SETFL, &Fcntl::O_NONBLOCK if $SIGPIPE_W; # just in case 1149 fcntl $SIGPIPE_W, &Fcntl::F_SETFL, &Fcntl::O_NONBLOCK if $SIGPIPE_W; # just in case
1150
1151 # not strictly required, as $^F is normally 2, but let's make sure...
1152 fcntl $SIGPIPE_R, &Fcntl::F_SETFD, &Fcntl::FD_CLOEXEC;
1153 fcntl $SIGPIPE_W, &Fcntl::F_SETFD, &Fcntl::FD_CLOEXEC;
1146 } 1154 }
1147 1155
1148 $SIGPIPE_R 1156 $SIGPIPE_R
1149 or Carp::croak "AnyEvent: unable to create a signal reporting pipe: $!\n"; 1157 or Carp::croak "AnyEvent: unable to create a signal reporting pipe: $!\n";
1150
1151 # not strictly required, as $^F is normally 2, but let's make sure...
1152 fcntl $SIGPIPE_R, &Fcntl::F_SETFD, &Fcntl::FD_CLOEXEC;
1153 fcntl $SIGPIPE_W, &Fcntl::F_SETFD, &Fcntl::FD_CLOEXEC;
1154 1158
1155 $SIG_IO = AnyEvent->io (fh => $SIGPIPE_R, poll => "r", cb => \&_signal_exec); 1159 $SIG_IO = AnyEvent->io (fh => $SIGPIPE_R, poll => "r", cb => \&_signal_exec);
1156 } 1160 }
1157 1161
1158 my $signal = uc $arg{signal} 1162 my $signal = uc $arg{signal}
1336so on. 1340so on.
1337 1341
1338=head1 ENVIRONMENT VARIABLES 1342=head1 ENVIRONMENT VARIABLES
1339 1343
1340The following environment variables are used by this module or its 1344The following environment variables are used by this module or its
1341submodules: 1345submodules.
1346
1347Note that AnyEvent will remove I<all> environment variables starting with
1348C<PERL_ANYEVENT_> from C<%ENV> when it is loaded while taint mode is
1349enabled.
1342 1350
1343=over 4 1351=over 4
1344 1352
1345=item C<PERL_ANYEVENT_VERBOSE> 1353=item C<PERL_ANYEVENT_VERBOSE>
1346 1354
1952 use AnyEvent; 1960 use AnyEvent;
1953 1961
1954Similar considerations apply to $ENV{PERL_ANYEVENT_VERBOSE}, as that can 1962Similar considerations apply to $ENV{PERL_ANYEVENT_VERBOSE}, as that can
1955be used to probe what backend is used and gain other information (which is 1963be used to probe what backend is used and gain other information (which is
1956probably even less useful to an attacker than PERL_ANYEVENT_MODEL), and 1964probably even less useful to an attacker than PERL_ANYEVENT_MODEL), and
1957$ENV{PERL_ANYEGENT_STRICT}. 1965$ENV{PERL_ANYEVENT_STRICT}.
1958 1966
1959 1967
1960=head1 BUGS 1968=head1 BUGS
1961 1969
1962Perl 5.8 has numerous memleaks that sometimes hit this module and are hard 1970Perl 5.8 has numerous memleaks that sometimes hit this module and are hard

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines