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.135 by root, Sun May 25 04:49:01 2008 UTC vs.
Revision 1.140 by root, Mon May 26 06:18:53 2008 UTC

731no warnings; 731no warnings;
732use strict; 732use strict;
733 733
734use Carp; 734use Carp;
735 735
736our $VERSION = '4.03'; 736our $VERSION = '4.04';
737our $MODEL; 737our $MODEL;
738 738
739our $AUTOLOAD; 739our $AUTOLOAD;
740our @ISA; 740our @ISA;
741 741
742our @REGISTRY; 742our @REGISTRY;
743 743
744our $WIN32;
745
746BEGIN {
747 my $win32 = ! ! ($^O =~ /mswin32/i);
748 eval "sub WIN32(){ $win32 }";
749}
750
744our $verbose = $ENV{PERL_ANYEVENT_VERBOSE}*1; 751our $verbose = $ENV{PERL_ANYEVENT_VERBOSE}*1;
745 752
746our %PROTOCOL; # (ipv4|ipv6) => (1|2) 753our %PROTOCOL; # (ipv4|ipv6) => (1|2), higher numbers are preferred
747 754
748{ 755{
749 my $idx; 756 my $idx;
750 $PROTOCOL{$_} = ++$idx 757 $PROTOCOL{$_} = ++$idx
758 for reverse split /\s*,\s*/,
751 for split /\s*,\s*/, $ENV{PERL_ANYEVENT_PROTOCOLS} || "ipv4,ipv6"; 759 $ENV{PERL_ANYEVENT_PROTOCOLS} || "ipv4,ipv6";
752} 760}
753 761
754my @models = ( 762my @models = (
755 [EV:: => AnyEvent::Impl::EV::], 763 [EV:: => AnyEvent::Impl::EV::],
756 [Event:: => AnyEvent::Impl::Event::], 764 [Event:: => AnyEvent::Impl::Event::],
792} 800}
793 801
794sub detect() { 802sub detect() {
795 unless ($MODEL) { 803 unless ($MODEL) {
796 no strict 'refs'; 804 no strict 'refs';
805 local $SIG{__DIE__};
797 806
798 if ($ENV{PERL_ANYEVENT_MODEL} =~ /^([a-zA-Z]+)$/) { 807 if ($ENV{PERL_ANYEVENT_MODEL} =~ /^([a-zA-Z]+)$/) {
799 my $model = "AnyEvent::Impl::$1"; 808 my $model = "AnyEvent::Impl::$1";
800 if (eval "require $model") { 809 if (eval "require $model") {
801 $MODEL = $model; 810 $MODEL = $model;
924 or Carp::croak "required option 'pid' is missing"; 933 or Carp::croak "required option 'pid' is missing";
925 934
926 $PID_CB{$pid}{$arg{cb}} = $arg{cb}; 935 $PID_CB{$pid}{$arg{cb}} = $arg{cb};
927 936
928 unless ($WNOHANG) { 937 unless ($WNOHANG) {
929 $WNOHANG = eval { require POSIX; &POSIX::WNOHANG } || 1; 938 $WNOHANG = eval { local $SIG{__DIE__}; require POSIX; &POSIX::WNOHANG } || 1;
930 } 939 }
931 940
932 unless ($CHLD_W) { 941 unless ($CHLD_W) {
933 $CHLD_W = AnyEvent->signal (signal => 'CHLD', cb => \&_sigchld); 942 $CHLD_W = AnyEvent->signal (signal => 'CHLD', cb => \&_sigchld);
934 # child could be a zombie already, so make at least one round 943 # child could be a zombie already, so make at least one round

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines