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.390 by root, Tue Oct 4 17:45:04 2011 UTC vs.
Revision 1.398 by root, Tue Mar 27 16:21:11 2012 UTC

433as you cannot do race-free signal handling in perl, requiring 433as you cannot do race-free signal handling in perl, requiring
434C libraries for this. AnyEvent will try to do its best, which 434C libraries for this. AnyEvent will try to do its best, which
435means in some cases, signals will be delayed. The maximum time 435means in some cases, signals will be delayed. The maximum time
436a signal might be delayed is 10 seconds by default, but can 436a signal might be delayed is 10 seconds by default, but can
437be overriden via C<$ENV{PERL_ANYEVENT_MAX_SIGNAL_LATENCY}> or 437be overriden via C<$ENV{PERL_ANYEVENT_MAX_SIGNAL_LATENCY}> or
438C<$AnyEvent::MAX_SIGNAL_LATENCY> - see the Ö<ENVIRONMENT VARIABLES> 438C<$AnyEvent::MAX_SIGNAL_LATENCY> - see the L<ENVIRONMENT VARIABLES>
439section for details. 439section for details.
440 440
441All these problems can be avoided by installing the optional 441All these problems can be avoided by installing the optional
442L<Async::Interrupt> module, which works with most event loops. It will not 442L<Async::Interrupt> module, which works with most event loops. It will not
443work with inherently broken event loops such as L<Event> or L<Event::Lib> 443work with inherently broken event loops such as L<Event> or L<Event::Lib>
1223 1223
1224package AnyEvent; 1224package AnyEvent;
1225 1225
1226# basically a tuned-down version of common::sense 1226# basically a tuned-down version of common::sense
1227sub common_sense { 1227sub 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
1234BEGIN { AnyEvent::common_sense } 1235BEGIN { AnyEvent::common_sense }
1235 1236
1236use Carp (); 1237use Carp ();
1237 1238
1238our $VERSION = '6.1'; 1239our $VERSION = '6.14';
1239our $MODEL; 1240our $MODEL;
1240our @ISA; 1241our @ISA;
1241our @REGISTRY; 1242our @REGISTRY;
1242our $VERBOSE; 1243our $VERBOSE;
1243our %PROTOCOL; # (ipv4|ipv6) => (1|2), higher numbers are preferred 1244our %PROTOCOL; # (ipv4|ipv6) => (1|2), higher numbers are preferred
1395 1396
1396 # IO::Async::Loop::AnyEvent is extremely evil, refuse to work with it 1397 # IO::Async::Loop::AnyEvent is extremely evil, refuse to work with it
1397 # the author knows about the problems and what it does to AnyEvent as a whole 1398 # the author knows about the problems and what it does to AnyEvent as a whole
1398 # (and the ability of others to use AnyEvent), but simply wants to abuse AnyEvent 1399 # (and the ability of others to use AnyEvent), but simply wants to abuse AnyEvent
1399 # anyway. 1400 # anyway.
1400 AnyEvent::log fatal => "AnyEvent: IO::Async::Loop::AnyEvent detected - this module is broken by design,\n" 1401 AnyEvent::log fatal => "AnyEvent: IO::Async::Loop::AnyEvent detected - that module is broken by\n"
1401 . "abuses internals and breaks AnyEvent, will not continue." 1402 . "design, abuses internals and breaks AnyEvent - will not continue."
1402 if exists $INC{"IO/Async/Loop/AnyEvent.pm"}; 1403 if exists $INC{"IO/Async/Loop/AnyEvent.pm"};
1403 1404
1404 local $!; # for good measure 1405 local $!; # for good measure
1405 local $SIG{__DIE__}; # we use eval 1406 local $SIG{__DIE__}; # we use eval
1406 1407
1432 if (${"$package\::VERSION"} > 0) { 1433 if (${"$package\::VERSION"} > 0) {
1433 if (eval "require $model") { 1434 if (eval "require $model") {
1434 AnyEvent::log 7 => "autodetected model '$model', using it."; 1435 AnyEvent::log 7 => "autodetected model '$model', using it.";
1435 $MODEL = $model; 1436 $MODEL = $model;
1436 last; 1437 last;
1438 } else {
1439 AnyEvent::log 8 => "detected event loop $package, but cannot load '$model', skipping: $@";
1437 } 1440 }
1438 } 1441 }
1439 } 1442 }
1440 1443
1441 unless ($MODEL) { 1444 unless ($MODEL) {
2071 2074
2072=over 4 2075=over 4
2073 2076
2074=item C<PERL_ANYEVENT_VERBOSE> 2077=item C<PERL_ANYEVENT_VERBOSE>
2075 2078
2076By default, AnyEvent will only log messages with loglevel C<3> 2079By default, AnyEvent will log messages with loglevel C<4> (C<error>) or
2077(C<critical>) or higher (see L<AnyEvent::Log>). You can set this 2080higher (see L<AnyEvent::Log>). You can set this environment variable to a
2078environment variable to a numerical loglevel to make AnyEvent more (or 2081numerical loglevel to make AnyEvent more (or less) talkative.
2079less) talkative.
2080 2082
2081If you want to do more than just set the global logging level 2083If you want to do more than just set the global logging level
2082you should have a look at C<PERL_ANYEVENT_LOG>, which allows much more 2084you should have a look at C<PERL_ANYEVENT_LOG>, which allows much more
2083complex specifications. 2085complex specifications.
2084 2086
2085When set to C<0> (C<off>), then no messages whatsoever will be logged with 2087When set to C<0> (C<off>), then no messages whatsoever will be logged with
2086the default logging settings. 2088everything else at defaults.
2087 2089
2088When set to C<5> or higher (C<warn>), causes AnyEvent to warn about 2090When set to C<5> or higher (C<warn>), AnyEvent warns about unexpected
2089unexpected conditions, such as not being able to load the event model 2091conditions, such as not being able to load the event model specified by
2090specified by C<PERL_ANYEVENT_MODEL>, or a guard callback throwing an 2092C<PERL_ANYEVENT_MODEL>, or a guard callback throwing an exception - this
2091exception - this is the minimum recommended level. 2093is the minimum recommended level for use during development.
2092 2094
2093When set to C<7> or higher (info), cause AnyEvent to report which event model it 2095When set to C<7> or higher (info), AnyEvent reports which event model it
2094chooses. 2096chooses.
2095 2097
2096When set to C<8> or higher (debug), then AnyEvent will report extra information on 2098When set to C<8> or higher (debug), then AnyEvent will report extra
2097which optional modules it loads and how it implements certain features. 2099information on which optional modules it loads and how it implements
2100certain features.
2098 2101
2099=item C<PERL_ANYEVENT_LOG> 2102=item C<PERL_ANYEVENT_LOG>
2100 2103
2101Accepts rather complex logging specifications. For example, you could log 2104Accepts rather complex logging specifications. For example, you could log
2102all C<debug> messages of some module to stderr, warnings and above to 2105all C<debug> messages of some module to stderr, warnings and above to
2109This variable is evaluated when AnyEvent (or L<AnyEvent::Log>) is loaded, 2112This variable is evaluated when AnyEvent (or L<AnyEvent::Log>) is loaded,
2110so will take effect even before AnyEvent has initialised itself. 2113so will take effect even before AnyEvent has initialised itself.
2111 2114
2112Note that specifying this environment variable causes the L<AnyEvent::Log> 2115Note that specifying this environment variable causes the L<AnyEvent::Log>
2113module to be loaded, while C<PERL_ANYEVENT_VERBOSE> does not, so only 2116module to be loaded, while C<PERL_ANYEVENT_VERBOSE> does not, so only
2114using the latter saves a few hundred kB of memory until the first message 2117using the latter saves a few hundred kB of memory unless a module
2115is being logged. 2118explicitly needs the extra features of AnyEvent::Log.
2116 2119
2117=item C<PERL_ANYEVENT_STRICT> 2120=item C<PERL_ANYEVENT_STRICT>
2118 2121
2119AnyEvent does not do much argument checking by default, as thorough 2122AnyEvent does not do much argument checking by default, as thorough
2120argument checking is very costly. Setting this variable to a true value 2123argument checking is very costly. Setting this variable to a true value

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines