… | |
… | |
433 | as you cannot do race-free signal handling in perl, requiring |
433 | as you cannot do race-free signal handling in perl, requiring |
434 | C libraries for this. AnyEvent will try to do its best, which |
434 | C libraries for this. AnyEvent will try to do its best, which |
435 | means in some cases, signals will be delayed. The maximum time |
435 | means in some cases, signals will be delayed. The maximum time |
436 | a signal might be delayed is 10 seconds by default, but can |
436 | a signal might be delayed is 10 seconds by default, but can |
437 | be overriden via C<$ENV{PERL_ANYEVENT_MAX_SIGNAL_LATENCY}> or |
437 | be overriden via C<$ENV{PERL_ANYEVENT_MAX_SIGNAL_LATENCY}> or |
438 | C<$AnyEvent::MAX_SIGNAL_LATENCY> - see the Ö<ENVIRONMENT VARIABLES> |
438 | C<$AnyEvent::MAX_SIGNAL_LATENCY> - see the L<ENVIRONMENT VARIABLES> |
439 | section for details. |
439 | section for details. |
440 | |
440 | |
441 | All these problems can be avoided by installing the optional |
441 | All these problems can be avoided by installing the optional |
442 | L<Async::Interrupt> module, which works with most event loops. It will not |
442 | L<Async::Interrupt> module, which works with most event loops. It will not |
443 | work with inherently broken event loops such as L<Event> or L<Event::Lib> |
443 | work with inherently broken event loops such as L<Event> or L<Event::Lib> |
… | |
… | |
1223 | |
1223 | |
1224 | package AnyEvent; |
1224 | package AnyEvent; |
1225 | |
1225 | |
1226 | # basically a tuned-down version of common::sense |
1226 | # basically a tuned-down version of common::sense |
1227 | sub common_sense { |
1227 | sub common_sense { |
1228 | # from common:.sense 3.4 |
1228 | # from common:.sense 3.5 |
|
|
1229 | local $^W; |
1229 | ${^WARNING_BITS} ^= ${^WARNING_BITS} ^ "\x3c\x3f\x33\x00\x0f\xf0\x0f\xc0\xf0\xfc\x33\x00"; |
1230 | ${^WARNING_BITS} ^= ${^WARNING_BITS} ^ "\x3c\x3f\x33\x00\x0f\xf0\x0f\xc0\xf0\xfc\x33\x00"; |
1230 | # use strict vars subs - NO UTF-8, as Util.pm doesn't like this atm. (uts46data.pl) |
1231 | # use strict vars subs - NO UTF-8, as Util.pm doesn't like this atm. (uts46data.pl) |
1231 | $^H |= 0x00000600; |
1232 | $^H |= 0x00000600; |
1232 | } |
1233 | } |
1233 | |
1234 | |
1234 | BEGIN { AnyEvent::common_sense } |
1235 | BEGIN { AnyEvent::common_sense } |
1235 | |
1236 | |
1236 | use Carp (); |
1237 | use Carp (); |
1237 | |
1238 | |
1238 | our $VERSION = '6.13'; |
1239 | our $VERSION = '6.14'; |
1239 | our $MODEL; |
1240 | our $MODEL; |
1240 | our @ISA; |
1241 | our @ISA; |
1241 | our @REGISTRY; |
1242 | our @REGISTRY; |
1242 | our $VERBOSE; |
1243 | our $VERBOSE; |
1243 | our %PROTOCOL; # (ipv4|ipv6) => (1|2), higher numbers are preferred |
1244 | our %PROTOCOL; # (ipv4|ipv6) => (1|2), higher numbers are preferred |
… | |
… | |
2073 | |
2074 | |
2074 | =over 4 |
2075 | =over 4 |
2075 | |
2076 | |
2076 | =item C<PERL_ANYEVENT_VERBOSE> |
2077 | =item C<PERL_ANYEVENT_VERBOSE> |
2077 | |
2078 | |
2078 | By default, AnyEvent will only log messages with loglevel C<3> |
2079 | By default, AnyEvent will log messages with loglevel C<4> (C<error>) or |
2079 | (C<critical>) or higher (see L<AnyEvent::Log>). You can set this |
2080 | higher (see L<AnyEvent::Log>). You can set this environment variable to a |
2080 | environment variable to a numerical loglevel to make AnyEvent more (or |
2081 | numerical loglevel to make AnyEvent more (or less) talkative. |
2081 | less) talkative. |
|
|
2082 | |
2082 | |
2083 | If you want to do more than just set the global logging level |
2083 | If you want to do more than just set the global logging level |
2084 | you should have a look at C<PERL_ANYEVENT_LOG>, which allows much more |
2084 | you should have a look at C<PERL_ANYEVENT_LOG>, which allows much more |
2085 | complex specifications. |
2085 | complex specifications. |
2086 | |
2086 | |
2087 | When set to C<0> (C<off>), then no messages whatsoever will be logged with |
2087 | When set to C<0> (C<off>), then no messages whatsoever will be logged with |
2088 | the default logging settings. |
2088 | everything else at defaults. |
2089 | |
2089 | |
2090 | When set to C<5> or higher (C<warn>), causes AnyEvent to warn about |
2090 | When set to C<5> or higher (C<warn>), AnyEvent warns about unexpected |
2091 | unexpected conditions, such as not being able to load the event model |
2091 | conditions, such as not being able to load the event model specified by |
2092 | specified by C<PERL_ANYEVENT_MODEL>, or a guard callback throwing an |
2092 | C<PERL_ANYEVENT_MODEL>, or a guard callback throwing an exception - this |
2093 | exception - this is the minimum recommended level. |
2093 | is the minimum recommended level for use during development. |
2094 | |
2094 | |
2095 | When set to C<7> or higher (info), cause AnyEvent to report which event model it |
2095 | When set to C<7> or higher (info), AnyEvent reports which event model it |
2096 | chooses. |
2096 | chooses. |
2097 | |
2097 | |
2098 | When set to C<8> or higher (debug), then AnyEvent will report extra information on |
2098 | When set to C<8> or higher (debug), then AnyEvent will report extra |
2099 | which optional modules it loads and how it implements certain features. |
2099 | information on which optional modules it loads and how it implements |
|
|
2100 | certain features. |
2100 | |
2101 | |
2101 | =item C<PERL_ANYEVENT_LOG> |
2102 | =item C<PERL_ANYEVENT_LOG> |
2102 | |
2103 | |
2103 | Accepts rather complex logging specifications. For example, you could log |
2104 | Accepts rather complex logging specifications. For example, you could log |
2104 | all C<debug> messages of some module to stderr, warnings and above to |
2105 | all C<debug> messages of some module to stderr, warnings and above to |
… | |
… | |
2111 | This variable is evaluated when AnyEvent (or L<AnyEvent::Log>) is loaded, |
2112 | This variable is evaluated when AnyEvent (or L<AnyEvent::Log>) is loaded, |
2112 | so will take effect even before AnyEvent has initialised itself. |
2113 | so will take effect even before AnyEvent has initialised itself. |
2113 | |
2114 | |
2114 | Note that specifying this environment variable causes the L<AnyEvent::Log> |
2115 | Note that specifying this environment variable causes the L<AnyEvent::Log> |
2115 | module to be loaded, while C<PERL_ANYEVENT_VERBOSE> does not, so only |
2116 | module to be loaded, while C<PERL_ANYEVENT_VERBOSE> does not, so only |
2116 | using the latter saves a few hundred kB of memory until the first message |
2117 | using the latter saves a few hundred kB of memory unless a module |
2117 | is being logged. |
2118 | explicitly needs the extra features of AnyEvent::Log. |
2118 | |
2119 | |
2119 | =item C<PERL_ANYEVENT_STRICT> |
2120 | =item C<PERL_ANYEVENT_STRICT> |
2120 | |
2121 | |
2121 | AnyEvent does not do much argument checking by default, as thorough |
2122 | AnyEvent does not do much argument checking by default, as thorough |
2122 | argument checking is very costly. Setting this variable to a true value |
2123 | argument checking is very costly. Setting this variable to a true value |