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.372 by root, Thu Aug 25 01:29:11 2011 UTC vs.
Revision 1.373 by root, Thu Aug 25 03:08:48 2011 UTC

1291 1291
1292 () 1292 ()
1293} 1293}
1294 1294
1295sub log($$;@) { 1295sub log($$;@) {
1296 # only load the bug bloated module when we actually are about to log something
1297 if ($_[0] <= $VERBOSE) {
1296 require AnyEvent::Log; 1298 require AnyEvent::Log;
1297 # AnyEvent::Log overwrites this function 1299 # AnyEvent::Log overwrites this function
1298 goto &log; 1300 goto &log;
1301 }
1302}
1303
1304if (length $ENV{PERL_ANYEVENT_LOG}) {
1305 require AnyEvent::Log; # AnyEvent::Log does the thing for us
1299} 1306}
1300 1307
1301our @models = ( 1308our @models = (
1302 [EV:: => AnyEvent::Impl::EV:: , 1], 1309 [EV:: => AnyEvent::Impl::EV:: , 1],
1303 [AnyEvent::Loop:: => AnyEvent::Impl::Perl:: , 1], 1310 [AnyEvent::Loop:: => AnyEvent::Impl::Perl:: , 1],
1361 1368
1362 if ($ENV{PERL_ANYEVENT_MODEL} =~ /^([a-zA-Z0-9:]+)$/) { 1369 if ($ENV{PERL_ANYEVENT_MODEL} =~ /^([a-zA-Z0-9:]+)$/) {
1363 my $model = $1; 1370 my $model = $1;
1364 $model = "AnyEvent::Impl::$model" unless $model =~ s/::$//; 1371 $model = "AnyEvent::Impl::$model" unless $model =~ s/::$//;
1365 if (eval "require $model") { 1372 if (eval "require $model") {
1373 AnyEvent::log 7 => "loaded model '$model' (forced by \$ENV{PERL_ANYEVENT_MODEL}), using it.";
1366 $MODEL = $model; 1374 $MODEL = $model;
1367 AnyEvent::log 7 => "loaded model '$model' (forced by \$ENV{PERL_ANYEVENT_MODEL}), using it."
1368 if $VERBOSE >= 7;
1369 } else { 1375 } else {
1370 AnyEvent::log warn => "unable to load model '$model' (from \$ENV{PERL_ANYEVENT_MODEL}):\n$@"; 1376 AnyEvent::log warn => "unable to load model '$model' (from \$ENV{PERL_ANYEVENT_MODEL}):\n$@";
1371 } 1377 }
1372 } 1378 }
1373 1379
1375 unless ($MODEL) { 1381 unless ($MODEL) {
1376 for (@REGISTRY, @models) { 1382 for (@REGISTRY, @models) {
1377 my ($package, $model) = @$_; 1383 my ($package, $model) = @$_;
1378 if (${"$package\::VERSION"} > 0) { 1384 if (${"$package\::VERSION"} > 0) {
1379 if (eval "require $model") { 1385 if (eval "require $model") {
1386 AnyEvent::log 7 => "autodetected model '$model', using it.";
1380 $MODEL = $model; 1387 $MODEL = $model;
1381 AnyEvent::log 7 => "autodetected model '$model', using it."
1382 if $VERBOSE >= 7;
1383 last; 1388 last;
1384 } 1389 }
1385 } 1390 }
1386 } 1391 }
1387 1392
1393 $autoload 1398 $autoload
1394 and eval "require $package" 1399 and eval "require $package"
1395 and ${"$package\::VERSION"} > 0 1400 and ${"$package\::VERSION"} > 0
1396 and eval "require $model" 1401 and eval "require $model"
1397 ) { 1402 ) {
1403 AnyEvent::log 7 => "autoloaded model '$model', using it.";
1398 $MODEL = $model; 1404 $MODEL = $model;
1399 AnyEvent::log 7 => "autoloaded model '$model', using it."
1400 if $VERBOSE >= 7;
1401 last; 1405 last;
1402 } 1406 }
1403 } 1407 }
1404 1408
1405 $MODEL 1409 $MODEL
1421 } 1425 }
1422 1426
1423 _isa_set; 1427 _isa_set;
1424 1428
1425 # we're officially open! 1429 # we're officially open!
1426
1427 if (length $ENV{PERL_ANYEVENT_LOG}) {
1428 require AnyEvent::Log; # AnyEvent::Log does the thing for us
1429 }
1430 1430
1431 if ($ENV{PERL_ANYEVENT_STRICT}) { 1431 if ($ENV{PERL_ANYEVENT_STRICT}) {
1432 require AnyEvent::Strict; 1432 require AnyEvent::Strict;
1433 } 1433 }
1434 1434

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines