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.136 by root, Sun May 25 23:52:02 2008 UTC vs.
Revision 1.138 by root, Mon May 26 05:09:53 2008 UTC

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), higher numbers are preferred 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
751 for reverse split /\s*,\s*/, 758 for reverse split /\s*,\s*/,
752 $ENV{PERL_ANYEVENT_PROTOCOLS} || "ipv4,ipv6"; 759 $ENV{PERL_ANYEVENT_PROTOCOLS} || "ipv4,ipv6";
760}
761
762sub import {
763 shift;
764 return unless @_;
765
766 my $pkg = caller;
767
768 no strict 'refs';
769
770 for (@_) {
771 *{"$pkg\::WIN32"} = *WIN32 if $_ eq "WIN32";
772 }
753} 773}
754 774
755my @models = ( 775my @models = (
756 [EV:: => AnyEvent::Impl::EV::], 776 [EV:: => AnyEvent::Impl::EV::],
757 [Event:: => AnyEvent::Impl::Event::], 777 [Event:: => AnyEvent::Impl::Event::],
793} 813}
794 814
795sub detect() { 815sub detect() {
796 unless ($MODEL) { 816 unless ($MODEL) {
797 no strict 'refs'; 817 no strict 'refs';
818 local $SIG{__DIE__};
798 819
799 if ($ENV{PERL_ANYEVENT_MODEL} =~ /^([a-zA-Z]+)$/) { 820 if ($ENV{PERL_ANYEVENT_MODEL} =~ /^([a-zA-Z]+)$/) {
800 my $model = "AnyEvent::Impl::$1"; 821 my $model = "AnyEvent::Impl::$1";
801 if (eval "require $model") { 822 if (eval "require $model") {
802 $MODEL = $model; 823 $MODEL = $model;
925 or Carp::croak "required option 'pid' is missing"; 946 or Carp::croak "required option 'pid' is missing";
926 947
927 $PID_CB{$pid}{$arg{cb}} = $arg{cb}; 948 $PID_CB{$pid}{$arg{cb}} = $arg{cb};
928 949
929 unless ($WNOHANG) { 950 unless ($WNOHANG) {
930 $WNOHANG = eval { require POSIX; &POSIX::WNOHANG } || 1; 951 $WNOHANG = eval { local $SIG{__DIE__}; require POSIX; &POSIX::WNOHANG } || 1;
931 } 952 }
932 953
933 unless ($CHLD_W) { 954 unless ($CHLD_W) {
934 $CHLD_W = AnyEvent->signal (signal => 'CHLD', cb => \&_sigchld); 955 $CHLD_W = AnyEvent->signal (signal => 'CHLD', cb => \&_sigchld);
935 # child could be a zombie already, so make at least one round 956 # child could be a zombie already, so make at least one round

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines