r54230 - in /trunk/libanyevent-perl: ./ debian/ debian/source/ lib/ lib/AnyEvent/ lib/AnyEvent/Impl/ lib/AnyEvent/Util/

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sat Mar 13 19:41:07 UTC 2010


Author: jawnsy-guest
Date: Sat Mar 13 19:40:57 2010
New Revision: 54230

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=54230
Log:
* New upstream release
* Standards-Version 3.8.4 (no changes)
* Use new 3.0 (quilt) source format

Added:
    trunk/libanyevent-perl/constants.pl.PL
      - copied unchanged from r54227, branches/upstream/libanyevent-perl/current/constants.pl.PL
    trunk/libanyevent-perl/debian/source/
    trunk/libanyevent-perl/debian/source/format
Removed:
    trunk/libanyevent-perl/debian/README.source
Modified:
    trunk/libanyevent-perl/Changes
    trunk/libanyevent-perl/MANIFEST
    trunk/libanyevent-perl/META.json
    trunk/libanyevent-perl/META.yml
    trunk/libanyevent-perl/Makefile.PL
    trunk/libanyevent-perl/debian/changelog
    trunk/libanyevent-perl/debian/control
    trunk/libanyevent-perl/debian/rules
    trunk/libanyevent-perl/lib/AE.pm
    trunk/libanyevent-perl/lib/AnyEvent.pm
    trunk/libanyevent-perl/lib/AnyEvent/Handle.pm
    trunk/libanyevent-perl/lib/AnyEvent/Impl/EV.pm
    trunk/libanyevent-perl/lib/AnyEvent/Impl/EventLib.pm
    trunk/libanyevent-perl/lib/AnyEvent/Impl/POE.pm
    trunk/libanyevent-perl/lib/AnyEvent/Impl/Perl.pm
    trunk/libanyevent-perl/lib/AnyEvent/Socket.pm
    trunk/libanyevent-perl/lib/AnyEvent/Strict.pm
    trunk/libanyevent-perl/lib/AnyEvent/Util.pm
    trunk/libanyevent-perl/lib/AnyEvent/Util/uts46data.pl

Modified: trunk/libanyevent-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/Changes?rev=54230&op=diff
==============================================================================
--- trunk/libanyevent-perl/Changes (original)
+++ trunk/libanyevent-perl/Changes Sat Mar 13 19:40:57 2010
@@ -1,4 +1,28 @@
 Revision history for Perl extension AnyEvent.
+
+5.251 Sat Mar 13 00:58:21 CET 2010
+	- make test failed if it was run before make install, and
+          older versions of perl make our live very difficult, so
+          write constants.pl during Makefile.PL time.
+
+5.25  Sat Mar 13 00:23:14 CET 2010
+	- fix a race condition in AnyEvent::Handle that would cause
+          a "bio_read: unsupported method" error (in _another_
+          ssl connection) after user code threw an exception.
+        - added AnyEvent::Handle->destroyed method.
+	- speed up AnyEvent::Socket::format_address and ::format_ipv6.
+        - the AnyEvent::Util::fh_nonblocking function worked only
+          by lucky accident on win32.
+        - smaller and faster AnyEvent::Util::fh_nonblocking.
+        - when the (required!) Time::HiRes module is missing, AnyEvent
+          did not fall back to built-in time properly.
+        - do not load Fcntl at runtime, saving memory and loading time.
+        - precompile a number of constants and use them instead of runtime
+          detection and eval.
+        - free detection code after detection and similar memory optimisations.
+        - Perl backend timer interval best effort drift has been improved
+          (ame algorithm as EV).
+        - update unicode idna mapping table.
 
 5.24  Tue Jan  5 11:39:43 CET 2010
 	- cygwin never reports errors from failed connects. 1.5 just gives

Modified: trunk/libanyevent-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/MANIFEST?rev=54230&op=diff
==============================================================================
--- trunk/libanyevent-perl/MANIFEST (original)
+++ trunk/libanyevent-perl/MANIFEST Sat Mar 13 19:40:57 2010
@@ -4,6 +4,7 @@
 README
 Makefile.PL
 
+constants.pl.PL
 lib/AE.pm
 lib/AnyEvent.pm
 lib/AnyEvent/Intro.pod

Modified: trunk/libanyevent-perl/META.json
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/META.json?rev=54230&op=diff
==============================================================================
--- trunk/libanyevent-perl/META.json (original)
+++ trunk/libanyevent-perl/META.json Sat Mar 13 19:40:57 2010
@@ -1,1 +1,1 @@
-{"no_index":{"directory":["t","inc"]},"meta-spec":{"version":1.4,"url":"http://module-build.sourceforge.net/META-spec-v1.4.html"},"generated_by":"ExtUtils::MakeMaker version 6.54","distribution_type":"module","version":"5.24","name":"AnyEvent","author":[],"license":"unknown","build_requires":{"ExtUtils::MakeMaker":0},"requires":{},"recommends":{"Net::SSLeay":1.33,"Guard":1.02,"EV":3.05,"Async::Interrupt":1,"JSON::XS":2.2,"JSON":2.09},"abstract":null,"configure_requires":{"ExtUtils::MakeMaker":0}}
+{"no_index":{"directory":["t","inc"]},"meta-spec":{"version":1.4,"url":"http://module-build.sourceforge.net/META-spec-v1.4.html"},"generated_by":"ExtUtils::MakeMaker version 6.54","distribution_type":"module","version":"5.251","name":"AnyEvent","author":[],"license":"unknown","build_requires":{"ExtUtils::MakeMaker":0},"requires":{},"recommends":{"Net::SSLeay":1.33,"Guard":1.02,"EV":3.05,"Async::Interrupt":1,"JSON::XS":2.2,"JSON":2.09},"abstract":null,"configure_requires":{"ExtUtils::MakeMaker":0}}

Modified: trunk/libanyevent-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/META.yml?rev=54230&op=diff
==============================================================================
--- trunk/libanyevent-perl/META.yml (original)
+++ trunk/libanyevent-perl/META.yml Sat Mar 13 19:40:57 2010
@@ -11,7 +11,7 @@
    },
    "generated_by" : "ExtUtils::MakeMaker version 6.54",
    "distribution_type" : "module",
-   "version" : "5.24",
+   "version" : "5.251",
    "name" : "AnyEvent",
    "author" : [],
    "license" : "unknown",

Modified: trunk/libanyevent-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/Makefile.PL?rev=54230&op=diff
==============================================================================
--- trunk/libanyevent-perl/Makefile.PL (original)
+++ trunk/libanyevent-perl/Makefile.PL Sat Mar 13 19:40:57 2010
@@ -21,6 +21,9 @@
 
 EOF
 
+do "constants.pl.PL"
+   or die "cannot execute constants.pl.PL";
+
 WriteMakefile(
     dist	=> {
 	            PREOP	=> 'pod2text lib/AnyEvent.pm | tee README >$(DISTVNAME)/README; chmod -R u=rwX,go=rX . ;',
@@ -30,6 +33,7 @@
     test         => { TESTS => "t/*.t t/handle/*.t" },
     NAME         => "AnyEvent",
     VERSION_FROM => "lib/AnyEvent.pm",
+    PMLIBDIRS    => ["lib"],
     META_MERGE => {
         recommends => {
            "Net::SSLeay"      => 1.33,

Modified: trunk/libanyevent-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/debian/changelog?rev=54230&op=diff
==============================================================================
--- trunk/libanyevent-perl/debian/changelog (original)
+++ trunk/libanyevent-perl/debian/changelog Sat Mar 13 19:40:57 2010
@@ -1,3 +1,11 @@
+libanyevent-perl (5.251-1) UNRELEASED; urgency=low
+
+  * New upstream release
+  * Standards-Version 3.8.4 (no changes)
+  * Use new 3.0 (quilt) source format
+
+ -- Jonathan Yu <jawnsy at cpan.org>  Sat, 13 Mar 2010 15:09:14 -0500
+
 libanyevent-perl (5.240-1) unstable; urgency=low
 
   * New upstream release

Modified: trunk/libanyevent-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/debian/control?rev=54230&op=diff
==============================================================================
--- trunk/libanyevent-perl/debian/control (original)
+++ trunk/libanyevent-perl/debian/control Sat Mar 13 19:40:57 2010
@@ -1,13 +1,13 @@
 Source: libanyevent-perl
 Section: perl
 Priority: optional
-Build-Depends: debhelper (>= 7.0.50), quilt (>= 0.46-7)
+Build-Depends: debhelper (>= 7.0.50)
 Build-Depends-Indep: perl, netbase, libasync-interrupt-perl
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Jonathan Yu <jawnsy at cpan.org>,
  Ansgar Burchardt <ansgar at 43-1.org>, gregor herrmann <gregoa at debian.org>,
  Maximilian Gass <mxey at cloudconnected.org>
-Standards-Version: 3.8.3
+Standards-Version: 3.8.4
 Homepage: http://search.cpan.org/dist/AnyEvent/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libanyevent-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libanyevent-perl/

Modified: trunk/libanyevent-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/debian/rules?rev=54230&op=diff
==============================================================================
--- trunk/libanyevent-perl/debian/rules (original)
+++ trunk/libanyevent-perl/debian/rules Sat Mar 13 19:40:57 2010
@@ -4,7 +4,7 @@
 TMP     = $(CURDIR)/debian/$(PACKAGE)
 
 %:
-	dh --with quilt $@
+	dh $@
 
 override_dh_installexamples:
 	dh_installexamples

Added: trunk/libanyevent-perl/debian/source/format
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/debian/source/format?rev=54230&op=file
==============================================================================
--- trunk/libanyevent-perl/debian/source/format (added)
+++ trunk/libanyevent-perl/debian/source/format Sat Mar 13 19:40:57 2010
@@ -1,0 +1,1 @@
+3.0 (quilt)

Modified: trunk/libanyevent-perl/lib/AE.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AE.pm?rev=54230&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AE.pm (original)
+++ trunk/libanyevent-perl/lib/AE.pm Sat Mar 13 19:40:57 2010
@@ -23,7 +23,7 @@
 many mistakes are caught at compiletime with this API.
 
 Also, some backends (Perl and EV) are so fast that the method call
-overhead is very noticable (with EV it increases the time five- to
+overhead is very noticeable (with EV it increases the time five- to
 six-fold, with Perl the method call overhead is about a factor of two).
 
 At the moment, there will be no checking (L<AnyEvent::Strict> does not

Modified: trunk/libanyevent-perl/lib/AnyEvent.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent.pm?rev=54230&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent.pm Sat Mar 13 19:40:57 2010
@@ -1158,7 +1158,7 @@
 
 use Carp ();
 
-our $VERSION = '5.24';
+our $VERSION = '5.251';
 our $MODEL;
 
 our $AUTOLOAD;
@@ -1169,8 +1169,8 @@
 our $VERBOSE;
 
 BEGIN {
-   eval "sub CYGWIN(){" . (($^O =~ /cygwin/i) *1) . "}";
-   eval "sub WIN32 (){" . (($^O =~ /mswin32/i)*1) . "}";
+   require "AnyEvent/constants.pl";
+
    eval "sub TAINT (){" . (${^TAINT}          *1) . "}";
 
    delete @ENV{grep /^PERL_ANYEVENT_/, keys %ENV}
@@ -1242,61 +1242,64 @@
 }
 
 sub detect() {
+   # free some memory
+   *detect = sub () { $MODEL };
+
+   local $!; # for good measure
+   local $SIG{__DIE__};
+
+   if ($ENV{PERL_ANYEVENT_MODEL} =~ /^([a-zA-Z]+)$/) {
+      my $model = "AnyEvent::Impl::$1";
+      if (eval "require $model") {
+         $MODEL = $model;
+         warn "AnyEvent: loaded model '$model' (forced by \$ENV{PERL_ANYEVENT_MODEL}), using it.\n" if $VERBOSE >= 2;
+      } else {
+         warn "AnyEvent: unable to load model '$model' (from \$ENV{PERL_ANYEVENT_MODEL}):\n$@" if $VERBOSE;
+      }
+   }
+
+   # check for already loaded models
    unless ($MODEL) {
-      local $SIG{__DIE__};
-
-      if ($ENV{PERL_ANYEVENT_MODEL} =~ /^([a-zA-Z]+)$/) {
-         my $model = "AnyEvent::Impl::$1";
-         if (eval "require $model") {
-            $MODEL = $model;
-            warn "AnyEvent: loaded model '$model' (forced by \$ENV{PERL_ANYEVENT_MODEL}), using it.\n" if $VERBOSE >= 2;
-         } else {
-            warn "AnyEvent: unable to load model '$model' (from \$ENV{PERL_ANYEVENT_MODEL}):\n$@" if $VERBOSE;
+      for (@REGISTRY, @models) {
+         my ($package, $model) = @$_;
+         if (${"$package\::VERSION"} > 0) {
+            if (eval "require $model") {
+               $MODEL = $model;
+               warn "AnyEvent: autodetected model '$model', using it.\n" if $VERBOSE >= 2;
+               last;
+            }
          }
       }
 
-      # check for already loaded models
       unless ($MODEL) {
+         # try to autoload a model
          for (@REGISTRY, @models) {
-            my ($package, $model) = @$_;
-            if (${"$package\::VERSION"} > 0) {
-               if (eval "require $model") {
-                  $MODEL = $model;
-                  warn "AnyEvent: autodetected model '$model', using it.\n" if $VERBOSE >= 2;
-                  last;
-               }
+            my ($package, $model, $autoload) = @$_;
+            if (
+               $autoload
+               and eval "require $package"
+               and ${"$package\::VERSION"} > 0
+               and eval "require $model"
+            ) {
+               $MODEL = $model;
+               warn "AnyEvent: autoloaded model '$model', using it.\n" if $VERBOSE >= 2;
+               last;
             }
          }
 
-         unless ($MODEL) {
-            # try to autoload a model
-            for (@REGISTRY, @models) {
-               my ($package, $model, $autoload) = @$_;
-               if (
-                  $autoload
-                  and eval "require $package"
-                  and ${"$package\::VERSION"} > 0
-                  and eval "require $model"
-               ) {
-                  $MODEL = $model;
-                  warn "AnyEvent: autoloaded model '$model', using it.\n" if $VERBOSE >= 2;
-                  last;
-               }
-            }
-
-            $MODEL
-              or die "No event module selected for AnyEvent and autodetect failed. Install any one of these modules: EV, Event or Glib.\n";
-         }
+         $MODEL
+           or die "No event module selected for AnyEvent and autodetect failed. Install any one of these modules: EV, Event or Glib.\n";
       }
-
-      push @{"$MODEL\::ISA"}, "AnyEvent::Base";
-
-      unshift @ISA, $MODEL;
-
-      require AnyEvent::Strict if $ENV{PERL_ANYEVENT_STRICT};
-
-      (shift @post_detect)->() while @post_detect;
    }
+
+   @models = (); # free probe data
+
+   push @{"$MODEL\::ISA"}, "AnyEvent::Base";
+   unshift @ISA, $MODEL;
+
+   require AnyEvent::Strict if $ENV{PERL_ANYEVENT_STRICT};
+
+   (shift @post_detect)->() while @post_detect;
 
    $MODEL
 }
@@ -1305,9 +1308,9 @@
    (my $func = $AUTOLOAD) =~ s/.*://;
 
    $method{$func}
-      or Carp::croak "$func: not a valid method for AnyEvent objects";
-
-   detect unless $MODEL;
+      or Carp::croak "$func: not a valid AnyEvent class method";
+
+   detect;
 
    my $class = shift;
    $class->$func (@_);
@@ -1385,15 +1388,18 @@
 # default implementations for many methods
 
 sub _time() {
-   # probe for availability of Time::HiRes
-   if (eval "use Time::HiRes (); Time::HiRes::time (); 1") {
-      warn "AnyEvent: using Time::HiRes for sub-second timing accuracy.\n" if $VERBOSE >= 8;
-      *_time = \&Time::HiRes::time;
-      # if (eval "use POSIX (); (POSIX::times())...
-   } else {
-      warn "AnyEvent: using built-in time(), WARNING, no sub-second resolution!\n" if $VERBOSE;
-      *_time = sub { time }; # epic fail
-   }
+   eval q{ # poor man's autoloading
+      # probe for availability of Time::HiRes
+      if (eval "use Time::HiRes (); Time::HiRes::time (); 1") {
+         warn "AnyEvent: using Time::HiRes for sub-second timing accuracy.\n" if $VERBOSE >= 8;
+         *_time = \&Time::HiRes::time;
+         # if (eval "use POSIX (); (POSIX::times())...
+      } else {
+         warn "AnyEvent: using built-in time(), WARNING, no sub-second resolution!\n" if $VERBOSE;
+         *_time = sub (){ time }; # epic fail
+      }
+   };
+   die if $@;
 
    &_time
 }
@@ -1424,20 +1430,8 @@
 our (%SIG_ASY, %SIG_ASY_W);
 our ($SIG_COUNT, $SIG_TW);
 
-sub _signal_exec {
-   $HAVE_ASYNC_INTERRUPT
-      ? $SIGPIPE_R->drain
-      : sysread $SIGPIPE_R, (my $dummy), 9;
-
-   while (%SIG_EV) {
-      for (keys %SIG_EV) {
-         delete $SIG_EV{$_};
-         $_->() for values %{ $SIG_CB{$_} || {} };
-      }
-   }
-}
-
 # install a dummy wakeup watcher to reduce signal catching latency
+# used by Impls
 sub _sig_add() {
    unless ($SIG_COUNT++) {
       # try to align timer on a full-second boundary, if possible
@@ -1499,8 +1493,6 @@
       } else {
          warn "AnyEvent: using emulated perl signal handling with latency timer.\n" if $VERBOSE >= 8;
 
-         require Fcntl;
-
          if (AnyEvent::WIN32) {
             require AnyEvent::Util;
 
@@ -1509,12 +1501,12 @@
             AnyEvent::Util::fh_nonblocking ($SIGPIPE_W, 1) if $SIGPIPE_W; # just in case
          } else {
             pipe $SIGPIPE_R, $SIGPIPE_W;
-            fcntl $SIGPIPE_R, &Fcntl::F_SETFL, &Fcntl::O_NONBLOCK if $SIGPIPE_R;
-            fcntl $SIGPIPE_W, &Fcntl::F_SETFL, &Fcntl::O_NONBLOCK if $SIGPIPE_W; # just in case
+            fcntl $SIGPIPE_R, AnyEvent::F_SETFL, AnyEvent::O_NONBLOCK if $SIGPIPE_R;
+            fcntl $SIGPIPE_W, AnyEvent::F_SETFL, AnyEvent::O_NONBLOCK if $SIGPIPE_W; # just in case
 
             # not strictly required, as $^F is normally 2, but let's make sure...
-            fcntl $SIGPIPE_R, &Fcntl::F_SETFD, &Fcntl::FD_CLOEXEC;
-            fcntl $SIGPIPE_W, &Fcntl::F_SETFD, &Fcntl::FD_CLOEXEC;
+            fcntl $SIGPIPE_R, AnyEvent::F_SETFD, AnyEvent::FD_CLOEXEC;
+            fcntl $SIGPIPE_W, AnyEvent::F_SETFD, AnyEvent::FD_CLOEXEC;
          }
 
          $SIGPIPE_R
@@ -1578,8 +1570,22 @@
               undef $SIG{$signal}
             unless keys %{ $SIG_CB{$signal} };
       };
+
+      *_signal_exec = sub {
+         $HAVE_ASYNC_INTERRUPT
+            ? $SIGPIPE_R->drain
+            : sysread $SIGPIPE_R, (my $dummy), 9;
+
+         while (%SIG_EV) {
+            for (keys %SIG_EV) {
+               delete $SIG_EV{$_};
+               $_->() for values %{ $SIG_CB{$_} || {} };
+            }
+         }
+      };
    };
    die if $@;
+
    &signal
 }
 
@@ -1590,6 +1596,7 @@
 our $CHLD_DELAY_W;
 our $WNOHANG;
 
+# used by many Impl's
 sub _emit_childstatus($$) {
    my (undef, $rpid, $rstatus) = @_;
 
@@ -1598,78 +1605,92 @@
           values %{ $PID_CB{0}     || {} };
 }
 
-sub _sigchld {
-   my $pid;
-
-   AnyEvent->_emit_childstatus ($pid, $?)
-      while ($pid = waitpid -1, $WNOHANG) > 0;
-}
-
 sub child {
-   my (undef, %arg) = @_;
-
-   defined (my $pid = $arg{pid} + 0)
-      or Carp::croak "required option 'pid' is missing";
-
-   $PID_CB{$pid}{$arg{cb}} = $arg{cb};
-
-   # WNOHANG is almost cetrainly 1 everywhere
-   $WNOHANG ||= $^O =~ /^(?:openbsd|netbsd|linux|freebsd|cygwin|MSWin32)$/
-                ? 1
-                : eval { local $SIG{__DIE__}; require POSIX; &POSIX::WNOHANG } || 1;
-
-   unless ($CHLD_W) {
-      $CHLD_W = AE::signal CHLD => \&_sigchld;
-      # child could be a zombie already, so make at least one round
-      &_sigchld;
-   }
-
-   bless [$pid, $arg{cb}], "AnyEvent::Base::child"
-}
-
-sub AnyEvent::Base::child::DESTROY {
-   my ($pid, $cb) = @{$_[0]};
-
-   delete $PID_CB{$pid}{$cb};
-   delete $PID_CB{$pid} unless keys %{ $PID_CB{$pid} };
-
-   undef $CHLD_W unless keys %PID_CB;
+   eval q{ # poor man's autoloading {}
+      *_sigchld = sub {
+         my $pid;
+
+         AnyEvent->_emit_childstatus ($pid, $?)
+            while ($pid = waitpid -1, $WNOHANG) > 0;
+      };
+
+      *child = sub {
+         my (undef, %arg) = @_;
+
+         defined (my $pid = $arg{pid} + 0)
+            or Carp::croak "required option 'pid' is missing";
+
+         $PID_CB{$pid}{$arg{cb}} = $arg{cb};
+
+         # WNOHANG is almost cetrainly 1 everywhere
+         $WNOHANG ||= $^O =~ /^(?:openbsd|netbsd|linux|freebsd|cygwin|MSWin32)$/
+                      ? 1
+                      : eval { local $SIG{__DIE__}; require POSIX; &POSIX::WNOHANG } || 1;
+
+         unless ($CHLD_W) {
+            $CHLD_W = AE::signal CHLD => \&_sigchld;
+            # child could be a zombie already, so make at least one round
+            &_sigchld;
+         }
+
+         bless [$pid, $arg{cb}], "AnyEvent::Base::child"
+      };
+
+      *AnyEvent::Base::child::DESTROY = sub {
+         my ($pid, $cb) = @{$_[0]};
+
+         delete $PID_CB{$pid}{$cb};
+         delete $PID_CB{$pid} unless keys %{ $PID_CB{$pid} };
+
+         undef $CHLD_W unless keys %PID_CB;
+      };
+   };
+   die if $@;
+
+   &child
 }
 
 # idle emulation is done by simply using a timer, regardless
 # of whether the process is idle or not, and not letting
 # the callback use more than 50% of the time.
 sub idle {
-   my (undef, %arg) = @_;
-
-   my ($cb, $w, $rcb) = $arg{cb};
-
-   $rcb = sub {
-      if ($cb) {
-         $w = _time;
-         &$cb;
-         $w = _time - $w;
-
-         # never use more then 50% of the time for the idle watcher,
-         # within some limits
-         $w = 0.0001 if $w < 0.0001;
-         $w = 5      if $w > 5;
-
-         $w = AE::timer $w, 0, $rcb;
-      } else {
-         # clean up...
-         undef $w;
-         undef $rcb;
-      }
+   eval q{ # poor man's autoloading {}
+      *idle = sub {
+         my (undef, %arg) = @_;
+
+         my ($cb, $w, $rcb) = $arg{cb};
+
+         $rcb = sub {
+            if ($cb) {
+               $w = _time;
+               &$cb;
+               $w = _time - $w;
+
+               # never use more then 50% of the time for the idle watcher,
+               # within some limits
+               $w = 0.0001 if $w < 0.0001;
+               $w = 5      if $w > 5;
+
+               $w = AE::timer $w, 0, $rcb;
+            } else {
+               # clean up...
+               undef $w;
+               undef $rcb;
+            }
+         };
+
+         $w = AE::timer 0.05, 0, $rcb;
+
+         bless \\$cb, "AnyEvent::Base::idle"
+      };
+
+      *AnyEvent::Base::idle::DESTROY = sub {
+         undef $${$_[0]};
+      };
    };
-
-   $w = AE::timer 0.05, 0, $rcb;
-
-   bless \\$cb, "AnyEvent::Base::idle"
-}
-
-sub AnyEvent::Base::idle::DESTROY {
-   undef $${$_[0]};
+   die if $@;
+
+   &idle
 }
 
 package AnyEvent::CondVar;

Modified: trunk/libanyevent-perl/lib/AnyEvent/Handle.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Handle.pm?rev=54230&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Handle.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Handle.pm Sat Mar 13 19:40:57 2010
@@ -81,7 +81,7 @@
 
 =over 4
 
-=item $handle = B<new> AnyEvent::TLS fh => $filehandle, key => value...
+=item $handle = B<new> AnyEvent::Handle fh => $filehandle, key => value...
 
 The constructor supports these arguments (all as C<< key => value >> pairs).
 
@@ -1716,7 +1716,7 @@
 sub start_read {
    my ($self) = @_;
 
-   unless ($self->{_rw} || $self->{_eof}) {
+   unless ($self->{_rw} || $self->{_eof} || !$self->{fh}) {
       Scalar::Util::weaken $self;
 
       $self->{_rw} = AE::io $self->{fh}, 0, sub {
@@ -1819,6 +1819,7 @@
    while (length ($tmp = Net::SSLeay::BIO_read ($self->{_wbio}))) {
       $self->{wbuf} .= $tmp;
       $self->_drain_wbuf;
+      $self->{tls} or return; # tls session might have gone away in callback
    }
 
    $self->{_on_starttls}
@@ -1927,7 +1928,7 @@
 
 Shuts down the SSL connection - this makes a proper EOF handshake by
 sending a close notify to the other side, but since OpenSSL doesn't
-support non-blocking shut downs, it is not guarenteed that you can re-use
+support non-blocking shut downs, it is not guaranteed that you can re-use
 the stream afterwards.
 
 =cut
@@ -1935,7 +1936,7 @@
 sub stoptls {
    my ($self) = @_;
 
-   if ($self->{tls}) {
+   if ($self->{tls} && $self->{fh}) {
       Net::SSLeay::shutdown ($self->{tls});
 
       &_dotls;
@@ -2022,6 +2023,29 @@
    #nop
 }
 
+=item $handle->destroyed
+
+Returns false as long as the handle hasn't been destroyed by a call to C<<
+->destroy >>, true otherwise.
+
+Can be useful to decide whether the handle is still valid after some
+callback possibly destroyed the handle. For example, C<< ->push_write >>,
+C<< ->starttls >> and other methods can call user callbacks, which in turn
+can destroy the handle, so work can be avoided by checking sometimes:
+
+   $hdl->starttls ("accept");
+   return if $hdl->destroyed;
+   $hdl->push_write (...
+
+Note that the call to C<push_write> will silently be ignored if the handle
+has been destroyed, so often you can just ignore the possibility of the
+handle being destroyed.
+
+=cut
+
+sub destroyed { 0 }
+sub AnyEvent::Handle::destroyed::destroyed { 1 }
+
 =item AnyEvent::Handle::TLS_CTX
 
 This function creates and returns the AnyEvent::TLS object used by default

Modified: trunk/libanyevent-perl/lib/AnyEvent/Impl/EV.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Impl/EV.pm?rev=54230&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Impl/EV.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Impl/EV.pm Sat Mar 13 19:40:57 2010
@@ -34,7 +34,7 @@
    EV::timer $arg{after}, $arg{interval}, $arg{cb}
 }
 
-*AE::io = defined &EV::_ae_io
+*AE::io = defined &EV::_ae_io # 3.8
    ? \&EV::_ae_io
    : sub($$$) { EV::io $_[0], $_[1] ? EV::WRITE : EV::READ, $_[2] };
 

Modified: trunk/libanyevent-perl/lib/AnyEvent/Impl/EventLib.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Impl/EventLib.pm?rev=54230&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Impl/EventLib.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Impl/EventLib.pm Sat Mar 13 19:40:57 2010
@@ -17,9 +17,10 @@
 
 The L<Event::Lib> module suffers from the same limitations and bugs
 as libevent, most notably it kills already-installed watchers on a
-file descriptor and it is unable to support fork. It has many other bugs
-such as taking references to file handles and callbacks instead of making
-a copy. Only Tk rivals it in its brokenness.
+file descriptor and it is unable to support fork. These are not fatal
+issues, but L<Event::Lib> itself has many additional bugs such as taking
+references to file handles and callbacks instead of making a copy, causing
+memory corruption and random crashes. Only Tk rivals it in its brokenness.
 
 This adaptor module employs the same workaround around the watcher problem
 as Tk and should therefore be avoided. (This was done for simplicity, one

Modified: trunk/libanyevent-perl/lib/AnyEvent/Impl/POE.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Impl/POE.pm?rev=54230&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Impl/POE.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Impl/POE.pm Sat Mar 13 19:40:57 2010
@@ -16,7 +16,7 @@
 This module provides transparent support for AnyEvent. You don't have to
 do anything to make POE work with AnyEvent except by loading POE before
 creating the first AnyEvent watcher. There are some cases where POE will
-issue spurious (and non-suppressable) warnings. These can be avoided by
+issue spurious (and non-suppressible) warnings. These can be avoided by
 loading AnyEvent::Impl::POE before loading any other modules using POE and
 AnyEvent, i.e. in your main program.
 
@@ -35,7 +35,7 @@
 =item Weird messages
 
 If you only use C<run_one_timeslice> (as AnyEvent has to for it's
-condition variables), POE will print an ugly, unsupressable, message at
+condition variables), POE will print an ugly, unsuppressible, message at
 program exit:
 
    Sessions were started, but POE::Kernel's run() method was never...
@@ -99,7 +99,7 @@
 differ by more than a second - and user code is left guessing which one is
 used.
 
-In addition, most timer functions in POE want an absoltue timestamp, which
+In addition, most timer functions in POE want an absolute timestamp, which
 is hard to create if all you have is a relative time and no function to
 return the "current time".
 
@@ -113,7 +113,7 @@
 
 =item Event Non-Ordering
 
-POE cannot guarentee the order of callback invocation for timers, and
+POE cannot guarantee the order of callback invocation for timers, and
 usually gets it wrong. That is, if you have two timers, one timing out
 after another (all else being equal), the callbacks might be called in
 reverse order.
@@ -159,8 +159,8 @@
 stuff as trivial as AnyEvent watchers without having to resort to
 undocumented behaviour or features.
 
-For example, the POE::Kernel manpage has nine occurances of the word TODO
-with an explanation of whats missing. In general, the POE manpages are
+For example, the POE::Kernel manpage has nine occurrences of the word TODO
+with an explanation of whats missing. In general, the POE man pages are
 littered with comments like "section not yet written".
 
 Some other gems:
@@ -188,17 +188,18 @@
    get_next_event_time() returns the time the next event is due, in a form
    compatible with the UNIX time() function.
 
-And surely, one would hope that POE supports subsecond accuracy as
+And surely, one would hope that POE supports sub-second accuracy as
 documented elsewhere, unlike the explanation above implies. Yet:
 
    POE::Kernel timers support subsecond accuracy, but don’t expect too
    much here. Perl is not the right language for realtime programming.
 
-... of course, Perl is not the right language to expect subsecond accuray
-- the manpage author must hate Perl to spread so much FUD in so little
-space. The Deliantra game server logs with 100µs-accuracy because Perl is
-fast enough to require this, and is still able to deliver map updates with
-little jitter at exactly the right time. It does not, however, use POE.
+... of course, Perl is not the right language to expect sub-second
+accuracy - the manpage author must hate Perl to spread so much FUD in
+so little space. The Deliantra game server logs with 100µs-accuracy
+because Perl is fast enough to require this, and is still able to deliver
+map updates with little jitter at exactly the right time. It does not,
+however, use POE.
 
    Furthermore, since the Kernel keeps track of everything sessions do, it
    knows when a session has run out of tasks to perform.
@@ -254,7 +255,7 @@
 =item No idle events
 
 The POE-recommended workaround to this is apparently to use
-C<fork>. Consequently, idle watchera will have to be emulated by AnyEvent.
+C<fork>. Consequently, idle watchers will have to be emulated by AnyEvent.
 
 =back
 

Modified: trunk/libanyevent-perl/lib/AnyEvent/Impl/Perl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Impl/Perl.pm?rev=54230&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Impl/Perl.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Impl/Perl.pm Sat Mar 13 19:40:57 2010
@@ -106,6 +106,7 @@
 package AnyEvent::Impl::Perl;
 
 use Scalar::Util qw(weaken);
+use List::Util ();
 
 use AnyEvent (); BEGIN { AnyEvent::common_sense }
 use AnyEvent::Util ();
@@ -310,7 +311,7 @@
 
    if ($interval) {
       $self = [$MNOW + $after , sub {
-         $_[0][0] = $MNOW + $interval;
+         $_[0][0] = List::Util::max $_[0][0] + $interval, $MNOW;
          push @timer, $_[0];
          weaken $timer[-1];
          $need_sort = $_[0][0] if $_[0][0] < $need_sort;

Modified: trunk/libanyevent-perl/lib/AnyEvent/Socket.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Socket.pm?rev=54230&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Socket.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Socket.pm Sat Mar 13 19:40:57 2010
@@ -383,44 +383,45 @@
 }
 
 sub format_ipv6($) {
-   if (v0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 eq $_[0]) {
-      return "::";
-   } elsif (v0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1 eq $_[0]) {
-      return "::1";
-   } elsif (v0.0.0.0.0.0.0.0.0.0.0.0 eq substr $_[0], 0, 12) {
-      # v4compatible
-      return "::" . format_ipv4 substr $_[0], 12;
-   } elsif (v0.0.0.0.0.0.0.0.0.0.255.255 eq substr $_[0], 0, 12) {
-      # v4mapped
-      return "::ffff:" . format_ipv4 substr $_[0], 12;
-   } elsif (v0.0.0.0.0.0.0.0.255.255.0.0 eq substr $_[0], 0, 12) {
-      # v4translated
-      return "::ffff:0:" . format_ipv4 substr $_[0], 12;
-   } else {
-      my $ip = sprintf "%x:%x:%x:%x:%x:%x:%x:%x", unpack "n8", $_[0];
-
-      # this is rather sucky, I admit
-      $ip =~ s/^0:(?:0:)*(0$)?/::/
-         or $ip =~ s/(:0){7}$/::/ or $ip =~ s/(:0){7}/:/
-         or $ip =~ s/(:0){6}$/::/ or $ip =~ s/(:0){6}/:/
-         or $ip =~ s/(:0){5}$/::/ or $ip =~ s/(:0){5}/:/
-         or $ip =~ s/(:0){4}$/::/ or $ip =~ s/(:0){4}/:/
-         or $ip =~ s/(:0){3}$/::/ or $ip =~ s/(:0){3}/:/
-         or $ip =~ s/(:0){2}$/::/ or $ip =~ s/(:0){2}/:/
-         or $ip =~ s/(:0){1}$/::/ or $ip =~ s/(:0){1}/:/;
-      return $ip
-   }
+   if ($_[0] =~ /^\x00\x00\x00\x00\x00\x00\x00\x00/) {
+      if (v0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 eq $_[0]) {
+         return "::";
+      } elsif (v0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1 eq $_[0]) {
+         return "::1";
+      } elsif (v0.0.0.0.0.0.0.0.0.0.0.0 eq substr $_[0], 0, 12) {
+         # v4compatible
+         return "::" . format_ipv4 substr $_[0], 12;
+      } elsif (v0.0.0.0.0.0.0.0.0.0.255.255 eq substr $_[0], 0, 12) {
+         # v4mapped
+         return "::ffff:" . format_ipv4 substr $_[0], 12;
+      } elsif (v0.0.0.0.0.0.0.0.255.255.0.0 eq substr $_[0], 0, 12) {
+         # v4translated
+         return "::ffff:0:" . format_ipv4 substr $_[0], 12;
+      }
+   }
+
+   my $ip = sprintf "%x:%x:%x:%x:%x:%x:%x:%x", unpack "n8", $_[0];
+
+   # this is admittedly rather sucky
+      $ip =~ s/(?:^|:) 0:0:0:0:0:0:0 (?:$|:)/::/x
+   or $ip =~ s/(?:^|:)   0:0:0:0:0:0 (?:$|:)/::/x
+   or $ip =~ s/(?:^|:)     0:0:0:0:0 (?:$|:)/::/x
+   or $ip =~ s/(?:^|:)       0:0:0:0 (?:$|:)/::/x
+   or $ip =~ s/(?:^|:)         0:0:0 (?:$|:)/::/x
+   or $ip =~ s/(?:^|:)           0:0 (?:$|:)/::/x
+   or $ip =~ s/(?:^|:)             0 (?:$|:)/::/x;
+
+   $ip
 }
 
 sub format_address($) {
-   my $af = address_family $_[0];
-   if ($af == AF_INET) {
+   if (4 == length $_[0]) {
       return &format_ipv4;
-   } elsif ($af == AF_INET6) {
-      return (v0.0.0.0.0.0.0.0.0.0.255.255 eq substr $_[0], 0, 12)
-         ? format_ipv4 substr $_[0], 12
+   } elsif (16 == length $_[0]) {
+      return $_[0] =~ /^\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff(....)$/s
+         ? format_ipv4 $1
          : &format_ipv6;
-   } elsif ($af == AF_UNIX) {
+   } elsif (AF_UNIX == address_family $_[0]) {
       return "unix/"
    } else {
       return undef

Modified: trunk/libanyevent-perl/lib/AnyEvent/Strict.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Strict.pm?rev=54230&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Strict.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Strict.pm Sat Mar 13 19:40:57 2010
@@ -24,7 +24,6 @@
 package AnyEvent::Strict;
 
 use Carp qw(croak);
-use Fcntl ();
 
 use AnyEvent (); BEGIN { AnyEvent::common_sense }
 

Modified: trunk/libanyevent-perl/lib/AnyEvent/Util.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Util.pm?rev=54230&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Util.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Util.pm Sat Mar 13 19:40:57 2010
@@ -38,36 +38,20 @@
 our $VERSION = $AnyEvent::VERSION;
 
 BEGIN {
-   my $af_inet6 = eval { local $SIG{__DIE__}; &Socket::AF_INET6 };
-
-   # uhoh
-   $af_inet6 ||= 10 if $^O =~ /linux/;
-   $af_inet6 ||= 23 if $^O =~ /cygwin/i;
-   $af_inet6 ||= 23 if AnyEvent::WIN32;
-   $af_inet6 ||= 24 if $^O =~ /openbsd|netbsd/;
-   $af_inet6 ||= 28 if $^O =~ /freebsd/;
-
-   $af_inet6 && socket my $ipv6_socket, $af_inet6, &Socket::SOCK_STREAM, 0 # check if they can be created
-      or $af_inet6 = 0;
-
-   eval "sub AF_INET6() { $af_inet6 }"; die if $@;
-
-   delete $AnyEvent::PROTOCOL{ipv6} unless $af_inet6;
+   if (
+      $AnyEvent::PROTOCOL{ipv6}
+      && _AF_INET6
+      && socket my $ipv6_socket, _AF_INET6, Socket::SOCK_DGRAM(), 0 # check if they can be created
+   ) {
+      *AF_INET6 = \&_AF_INET6;
+   } else {
+      # disable ipv6
+      *AF_INET6 = sub () { 0 };
+      delete $AnyEvent::PROTOCOL{ipv6};
+   }
 }
 
 BEGIN {
-   # broken windows perls use undocumented error codes...
-   if (AnyEvent::WIN32) {
-      eval "sub WSAEINVAL      () { 10022 }";
-      eval "sub WSAEWOULDBLOCK () { 10035 }";
-      eval "sub WSAEINPROGRESS () { 10036 }";
-   } else {
-      # these should never match any errno value
-      eval "sub WSAEINVAL      () { -1e99 }";
-      eval "sub WSAEWOULDBLOCK () { -1e99 }";
-      eval "sub WSAEINPROGRESS () { -1e99 }";
-   }
-
    # fix buggy Errno on some non-POSIX platforms
    # such as openbsd and windows.
    my %ERR = (
@@ -117,7 +101,7 @@
          # vista returns fantasy port numbers.
 
          for (1..10) {
-            socket my $l, &Socket::AF_INET, &Socket::SOCK_STREAM, 0
+            socket my $l, Socket::AF_INET(), Socket::SOCK_STREAM(), 0
                or next;
 
             bind $l, Socket::pack_sockaddr_in 0, "\x7f\x00\x00\x01"
@@ -129,7 +113,7 @@
             listen $l, 1
                or next;
 
-            socket my $r, &Socket::AF_INET, &Socket::SOCK_STREAM, 0
+            socket my $r, Socket::AF_INET(), Socket::SOCK_STREAM(), 0
                or next;
 
             bind $r, Socket::pack_sockaddr_in 0, "\x7f\x00\x00\x01"
@@ -173,7 +157,7 @@
       };
 
       *portable_socketpair = sub () {
-         socketpair my $fh1, my $fh2, &Socket::AF_UNIX, &Socket::SOCK_STREAM, &Socket::PF_UNSPEC
+         socketpair my $fh1, my $fh2, Socket::AF_UNIX(), Socket::SOCK_STREAM(), Socket::PF_UNSPEC()
             or return;
 
          ($fh1, $fh2)
@@ -369,17 +353,15 @@
 
 =cut
 
-sub fh_nonblocking($$) {
-   my ($fh, $nb) = @_;
-
-   require Fcntl;
-
-   if (AnyEvent::WIN32) {
-      $nb = (! ! $nb) + 0;
-      ioctl $fh, 0x8004667e, \$nb; # FIONBIO
-   } else {
-      fcntl $fh, &Fcntl::F_SETFL, $nb ? &Fcntl::O_NONBLOCK : 0;
-   }
+BEGIN {
+   *fh_nonblocking = AnyEvent::WIN32
+      ? sub($$) {
+          ioctl $_[0], 0x8004667e, pack "L", $_[1]; # FIONBIO
+        }
+      : sub($$) {
+          fcntl $_[0], AnyEvent::F_SETFL, $_[1] ? AnyEvent::O_NONBLOCK : 0;
+        }
+   ;
 }
 
 =item $guard = guard { CODE }

Modified: trunk/libanyevent-perl/lib/AnyEvent/Util/uts46data.pl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Util/uts46data.pl?rev=54230&op=diff
==============================================================================
Binary files - no diff available.




More information about the Pkg-perl-cvs-commits mailing list