… | |
… | |
1156 | |
1156 | |
1157 | BEGIN { AnyEvent::common_sense } |
1157 | BEGIN { AnyEvent::common_sense } |
1158 | |
1158 | |
1159 | use Carp (); |
1159 | use Carp (); |
1160 | |
1160 | |
1161 | our $VERSION = '5.24'; |
1161 | our $VERSION = '5.251'; |
1162 | our $MODEL; |
1162 | our $MODEL; |
1163 | |
1163 | |
1164 | our $AUTOLOAD; |
1164 | our $AUTOLOAD; |
1165 | our @ISA; |
1165 | our @ISA; |
1166 | |
1166 | |
1167 | our @REGISTRY; |
1167 | our @REGISTRY; |
1168 | |
1168 | |
1169 | our $VERBOSE; |
1169 | our $VERBOSE; |
1170 | |
1170 | |
1171 | BEGIN { |
1171 | BEGIN { |
1172 | eval "sub CYGWIN(){" . (($^O =~ /cygwin/i) *1) . "}"; |
1172 | require "AnyEvent/constants.pl"; |
1173 | eval "sub WIN32 (){" . (($^O =~ /mswin32/i)*1) . "}"; |
1173 | |
1174 | eval "sub TAINT (){" . (${^TAINT} *1) . "}"; |
1174 | eval "sub TAINT (){" . (${^TAINT} *1) . "}"; |
1175 | |
1175 | |
1176 | delete @ENV{grep /^PERL_ANYEVENT_/, keys %ENV} |
1176 | delete @ENV{grep /^PERL_ANYEVENT_/, keys %ENV} |
1177 | if ${^TAINT}; |
1177 | if ${^TAINT}; |
1178 | |
1178 | |
… | |
… | |
1491 | $SIG_IO = AE::io $SIGPIPE_R->fileno, 0, \&_signal_exec; |
1491 | $SIG_IO = AE::io $SIGPIPE_R->fileno, 0, \&_signal_exec; |
1492 | |
1492 | |
1493 | } else { |
1493 | } else { |
1494 | warn "AnyEvent: using emulated perl signal handling with latency timer.\n" if $VERBOSE >= 8; |
1494 | warn "AnyEvent: using emulated perl signal handling with latency timer.\n" if $VERBOSE >= 8; |
1495 | |
1495 | |
1496 | require Fcntl; |
|
|
1497 | |
|
|
1498 | if (AnyEvent::WIN32) { |
1496 | if (AnyEvent::WIN32) { |
1499 | require AnyEvent::Util; |
1497 | require AnyEvent::Util; |
1500 | |
1498 | |
1501 | ($SIGPIPE_R, $SIGPIPE_W) = AnyEvent::Util::portable_pipe (); |
1499 | ($SIGPIPE_R, $SIGPIPE_W) = AnyEvent::Util::portable_pipe (); |
1502 | AnyEvent::Util::fh_nonblocking ($SIGPIPE_R, 1) if $SIGPIPE_R; |
1500 | AnyEvent::Util::fh_nonblocking ($SIGPIPE_R, 1) if $SIGPIPE_R; |
1503 | AnyEvent::Util::fh_nonblocking ($SIGPIPE_W, 1) if $SIGPIPE_W; # just in case |
1501 | AnyEvent::Util::fh_nonblocking ($SIGPIPE_W, 1) if $SIGPIPE_W; # just in case |
1504 | } else { |
1502 | } else { |
1505 | pipe $SIGPIPE_R, $SIGPIPE_W; |
1503 | pipe $SIGPIPE_R, $SIGPIPE_W; |
1506 | fcntl $SIGPIPE_R, &Fcntl::F_SETFL, &Fcntl::O_NONBLOCK if $SIGPIPE_R; |
1504 | fcntl $SIGPIPE_R, AnyEvent::F_SETFL, AnyEvent::O_NONBLOCK if $SIGPIPE_R; |
1507 | fcntl $SIGPIPE_W, &Fcntl::F_SETFL, &Fcntl::O_NONBLOCK if $SIGPIPE_W; # just in case |
1505 | fcntl $SIGPIPE_W, AnyEvent::F_SETFL, AnyEvent::O_NONBLOCK if $SIGPIPE_W; # just in case |
1508 | |
1506 | |
1509 | # not strictly required, as $^F is normally 2, but let's make sure... |
1507 | # not strictly required, as $^F is normally 2, but let's make sure... |
1510 | fcntl $SIGPIPE_R, &Fcntl::F_SETFD, &Fcntl::FD_CLOEXEC; |
1508 | fcntl $SIGPIPE_R, AnyEvent::F_SETFD, AnyEvent::FD_CLOEXEC; |
1511 | fcntl $SIGPIPE_W, &Fcntl::F_SETFD, &Fcntl::FD_CLOEXEC; |
1509 | fcntl $SIGPIPE_W, AnyEvent::F_SETFD, AnyEvent::FD_CLOEXEC; |
1512 | } |
1510 | } |
1513 | |
1511 | |
1514 | $SIGPIPE_R |
1512 | $SIGPIPE_R |
1515 | or Carp::croak "AnyEvent: unable to create a signal reporting pipe: $!\n"; |
1513 | or Carp::croak "AnyEvent: unable to create a signal reporting pipe: $!\n"; |
1516 | |
1514 | |
… | |
… | |
2526 | automatic timer adjustments even when no monotonic clock is available, |
2524 | automatic timer adjustments even when no monotonic clock is available, |
2527 | can take avdantage of advanced kernel interfaces such as C<epoll> and |
2525 | can take avdantage of advanced kernel interfaces such as C<epoll> and |
2528 | C<kqueue>, and is the fastest backend I<by far>. You can even embed |
2526 | C<kqueue>, and is the fastest backend I<by far>. You can even embed |
2529 | L<Glib>/L<Gtk2> in it (or vice versa, see L<EV::Glib> and L<Glib::EV>). |
2527 | L<Glib>/L<Gtk2> in it (or vice versa, see L<EV::Glib> and L<Glib::EV>). |
2530 | |
2528 | |
|
|
2529 | If you only use backends that rely on another event loop (e.g. C<Tk>), |
|
|
2530 | then this module will do nothing for you. |
|
|
2531 | |
2531 | =item L<Guard> |
2532 | =item L<Guard> |
2532 | |
2533 | |
2533 | The guard module, when used, will be used to implement |
2534 | The guard module, when used, will be used to implement |
2534 | C<AnyEvent::Util::guard>. This speeds up guards considerably (and uses a |
2535 | C<AnyEvent::Util::guard>. This speeds up guards considerably (and uses a |
2535 | lot less memory), but otherwise doesn't affect guard operation much. It is |
2536 | lot less memory), but otherwise doesn't affect guard operation much. It is |
2536 | purely used for performance. |
2537 | purely used for performance. |
2537 | |
2538 | |
2538 | =item L<JSON> and L<JSON::XS> |
2539 | =item L<JSON> and L<JSON::XS> |
2539 | |
2540 | |
2540 | One of these modules is required when you want to read or write JSON data |
2541 | One of these modules is required when you want to read or write JSON data |
2541 | via L<AnyEvent::Handle>. It is also written in pure-perl, but can take |
2542 | via L<AnyEvent::Handle>. L<JSON> is also written in pure-perl, but can take |
2542 | advantage of the ultra-high-speed L<JSON::XS> module when it is installed. |
2543 | advantage of the ultra-high-speed L<JSON::XS> module when it is installed. |
2543 | |
|
|
2544 | In fact, L<AnyEvent::Handle> will use L<JSON::XS> by default if it is |
|
|
2545 | installed. |
|
|
2546 | |
2544 | |
2547 | =item L<Net::SSLeay> |
2545 | =item L<Net::SSLeay> |
2548 | |
2546 | |
2549 | Implementing TLS/SSL in Perl is certainly interesting, but not very |
2547 | Implementing TLS/SSL in Perl is certainly interesting, but not very |
2550 | worthwhile: If this module is installed, then L<AnyEvent::Handle> (with |
2548 | worthwhile: If this module is installed, then L<AnyEvent::Handle> (with |