r65751 - in /trunk/libanyevent-perl: ./ debian/ lib/ lib/AnyEvent/ lib/AnyEvent/Impl/ t/

periapt-guest at users.alioth.debian.org periapt-guest at users.alioth.debian.org
Sat Dec 11 15:35:16 UTC 2010


Author: periapt-guest
Date: Sat Dec 11 15:35:02 2010
New Revision: 65751

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=65751
Log:
New upstream release

Removed:
    trunk/libanyevent-perl/META.json
Modified:
    trunk/libanyevent-perl/Changes
    trunk/libanyevent-perl/MANIFEST
    trunk/libanyevent-perl/META.yml
    trunk/libanyevent-perl/Makefile.PL
    trunk/libanyevent-perl/constants.pl.PL
    trunk/libanyevent-perl/debian/changelog
    trunk/libanyevent-perl/lib/AnyEvent.pm
    trunk/libanyevent-perl/lib/AnyEvent/FAQ.pod
    trunk/libanyevent-perl/lib/AnyEvent/Handle.pm
    trunk/libanyevent-perl/lib/AnyEvent/Impl/EV.pm
    trunk/libanyevent-perl/lib/AnyEvent/Impl/Irssi.pm
    trunk/libanyevent-perl/lib/AnyEvent/Impl/Tk.pm
    trunk/libanyevent-perl/lib/AnyEvent/Intro.pod
    trunk/libanyevent-perl/lib/AnyEvent/Strict.pm
    trunk/libanyevent-perl/t/08_idna.t

Modified: trunk/libanyevent-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/Changes?rev=65751&op=diff
==============================================================================
--- trunk/libanyevent-perl/Changes (original)
+++ trunk/libanyevent-perl/Changes Sat Dec 11 15:35:02 2010
@@ -1,8 +1,25 @@
 Revision history for Perl extension AnyEvent.
 
 TODO: document TCP_*** constants
-TODO: catch AE::xxx for anyevent struct and anyevent debug
+TODO: catch AE::xxx for anyevent strict and anyevent debug
 TODO: anyevent::trace? or debug tracing all watchers?
+TODO: anyevent strict checking for $_ changes?
+
+5.29   Sun Dec  5 10:49:21 CET 2010
+        - convert EV backend to EV 4.00 API (so better upgrade EV too).
+        - AE::Handle: implement dynamic read_size adjustment, add
+          max_read_size parameter, reduce default read_size to 2048.
+        - add some FAQ entries for servers and/or on_eof vs. on_error.
+	- work around OS bugs (cygwin again) when lingering in AE::Handle.
+        - reduce memory usage slightly when connect was used in AE::Handle.
+        - wrok around more segfaults in Tk.
+        - document tls_ctx => undef as valid.
+        - detect WNOHANG value at compiletime.
+        - include some probably linux-only support for building AnyEvent
+          as part of the perl core.
+        - improve compatibility of t/08_idna.t to perl 5.8.
+        - make AnyEvent::Strict truly optional (in case somebody builds a
+          minimal perl...).
 
 5.28   Wed Oct 13 04:14:23 CEST 2010
         - due to a glitch, AnyEvent's internal getprotobyname wasn't

Modified: trunk/libanyevent-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/MANIFEST?rev=65751&op=diff
==============================================================================
--- trunk/libanyevent-perl/MANIFEST (original)
+++ trunk/libanyevent-perl/MANIFEST Sat Dec 11 15:35:02 2010
@@ -55,4 +55,3 @@
 
 util/gen_uts46data
 META.yml                                 Module meta-data (added by MakeMaker)
-META.json                                Module meta-data (added by MakeMaker)

Modified: trunk/libanyevent-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/META.yml?rev=65751&op=diff
==============================================================================
--- trunk/libanyevent-perl/META.yml (original)
+++ trunk/libanyevent-perl/META.yml Sat Dec 11 15:35:02 2010
@@ -1,34 +1,27 @@
-{
-   "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.56",
-   "distribution_type" : "module",
-   "version" : "5.28",
-   "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
-   }
-}
+--- #YAML:1.0
+name:               AnyEvent
+version:            5.29
+abstract:           ~
+author:  []
+license:            unknown
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+build_requires:
+    ExtUtils::MakeMaker:  0
+requires:  {}
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.56
+meta-spec:
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4
+recommends:
+    Async::Interrupt:  1
+    EV:                4
+    Guard:             1.02
+    JSON:              2.09
+    JSON::XS:          2.2
+    Net::SSLeay:       1.33

Modified: trunk/libanyevent-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/Makefile.PL?rev=65751&op=diff
==============================================================================
--- trunk/libanyevent-perl/Makefile.PL (original)
+++ trunk/libanyevent-perl/Makefile.PL Sat Dec 11 15:35:02 2010
@@ -22,7 +22,7 @@
 EOF
 
 do "constants.pl.PL"
-   or die "cannot execute constants.pl.PL";
+   or die "cannot execute constants.pl.PL: $@";
 
 WriteMakefile(
     dist	=> {
@@ -39,7 +39,7 @@
            "Net::SSLeay"      => 1.33,
            "JSON"             => 2.09,
            "JSON::XS"         => 2.2,
-           "EV"               => 3.05,
+           "EV"               => 4.00,
            "Guard"            => 1.02,
            "Async::Interrupt" => 1.0,
         }

Modified: trunk/libanyevent-perl/constants.pl.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/constants.pl.PL?rev=65751&op=diff
==============================================================================
--- trunk/libanyevent-perl/constants.pl.PL (original)
+++ trunk/libanyevent-perl/constants.pl.PL Sat Dec 11 15:35:02 2010
@@ -3,7 +3,11 @@
 # this file is unfortunately only executed at Makefile.PL time
 
 use Config;
-use Socket;
+
+# when built as part of perl, these are not available
+BEGIN { eval "use Socket ()" }
+BEGIN { eval "use Fcntl  ()" }
+BEGIN { eval "use POSIX  ()" }
 
 open my $fh, ">lib/AnyEvent/constants.pl"
    or die "lib/AnyEvent/constants.pl: $_[0]\n";
@@ -29,12 +33,17 @@
 i WIN32  => $WIN32;
 
 # add these purely to avoid loading Fcntl, which is slow and bloated.
-use Fcntl ();
 
-i F_SETFL    => eval { Fcntl::F_SETFL() };
-i F_SETFD    => eval { Fcntl::F_SETFD() };
-i O_NONBLOCK => eval { Fcntl::O_NONBLOCK() };
-i FD_CLOEXEC => eval { Fcntl::FD_CLOEXEC() };
+i F_SETFD    => eval { Fcntl::F_SETFD() } || 2;
+i F_SETFL    => eval { Fcntl::F_SETFL() } || 4;
+i O_NONBLOCK => eval { Fcntl::O_NONBLOCK() } || 04000;
+i FD_CLOEXEC => eval { Fcntl::FD_CLOEXEC() } || 1;
+
+print "package AnyEvent::Base;\n";
+
+# add these purely to avoid loading POSIX, which is slow and bloated.
+
+i WNOHANG    => eval { POSIX::WNOHANG() } || 1;
 
 print "package AnyEvent::Util;\n";
 

Modified: trunk/libanyevent-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/debian/changelog?rev=65751&op=diff
==============================================================================
--- trunk/libanyevent-perl/debian/changelog (original)
+++ trunk/libanyevent-perl/debian/changelog Sat Dec 11 15:35:02 2010
@@ -1,3 +1,9 @@
+libanyevent-perl (5.290-1) UNRELEASED; urgency=low
+
+  * New upstream release
+
+ -- Nicholas Bamber <nicholas at periapt.co.uk>  Sat, 11 Dec 2010 15:34:59 +0000
+
 libanyevent-perl (5.280-1) unstable; urgency=low
 
   [ Nicholas Bamber ]

Modified: trunk/libanyevent-perl/lib/AnyEvent.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent.pm?rev=65751&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent.pm Sat Dec 11 15:35:02 2010
@@ -1169,7 +1169,7 @@
 
 use Carp ();
 
-our $VERSION = '5.28';
+our $VERSION = '5.29';
 our $MODEL;
 
 our $AUTOLOAD;
@@ -1293,7 +1293,7 @@
          }
 
          $MODEL
-           or die "No event module selected for AnyEvent and autodetect failed. Install any one of these modules: EV, Event or Glib.\n";
+           or die "AnyEvent: backend autodetection failed - did you properly install AnyEvent?\n";
       }
    }
 
@@ -1302,14 +1302,18 @@
    push @{"$MODEL\::ISA"}, "AnyEvent::Base";
    unshift @ISA, $MODEL;
 
-   # now nuke some methods that are overriden by the backend.
+   # now nuke some methods that are overridden by the backend.
    # SUPER is not allowed.
    for (qw(time signal child idle)) {
       undef &{"AnyEvent::Base::$_"}
          if defined &{"$MODEL\::$_"};
    }
 
-   require AnyEvent::Strict if $ENV{PERL_ANYEVENT_STRICT};
+   if ($ENV{PERL_ANYEVENT_STRICT}) {
+      eval { require AnyEvent::Strict };
+      warn "AnyEvent: cannot load AnyEvent::Strict: $@"
+         if $@ && $VERBOSE;
+   }
 
    (shift @post_detect)->() while @post_detect;
 
@@ -1626,7 +1630,6 @@
 our %PID_CB;
 our $CHLD_W;
 our $CHLD_DELAY_W;
-our $WNOHANG;
 
 # used by many Impl's
 sub _emit_childstatus($$) {
@@ -1643,7 +1646,7 @@
          my $pid;
 
          AnyEvent->_emit_childstatus ($pid, $?)
-            while ($pid = waitpid -1, $WNOHANG) > 0;
+            while ($pid = waitpid -1, WNOHANG) > 0;
       };
 
       *child = sub {
@@ -1653,11 +1656,6 @@
             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;

Modified: trunk/libanyevent-perl/lib/AnyEvent/FAQ.pod
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/FAQ.pod?rev=65751&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/FAQ.pod (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/FAQ.pod Sat Dec 11 15:35:02 2010
@@ -98,6 +98,11 @@
 big deal - as soon as your program actually implements something sensible,
 CPU usage will be normal.
 
+=item Why does this FAQ not deal with L<AnyEvent::Handle> questions?
+
+Because L<AnyEvent::Handle> has a NONFAQ on it's own that already deals
+with common issues.
+
 =head1 Authors
 
 Marc Lehmann <schmorp at schmorp.de>.

Modified: trunk/libanyevent-perl/lib/AnyEvent/Handle.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Handle.pm?rev=65751&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Handle.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Handle.pm Sat Dec 11 15:35:02 2010
@@ -77,6 +77,8 @@
    \&$func
 }
 
+sub MAX_READ_SIZE() { 131072 }
+
 =head1 METHODS
 
 =over 4
@@ -159,7 +161,7 @@
 fatal errors the handle object will be destroyed (by a call to C<< ->
 destroy >>) after invoking the error callback (which means you are free to
 examine the handle object). Examples of fatal errors are an EOF condition
-with active (but unsatisifable) read watchers (C<EPIPE>) or I/O errors. In
+with active (but unsatisfiable) read watchers (C<EPIPE>) or I/O errors. In
 cases where the other side can close the connection at will, it is
 often easiest to not report C<EPIPE> errors in this callback.
 
@@ -339,9 +341,17 @@
 
 =item read_size => <bytes>
 
-The default read block size (the number of bytes this module will
-try to read during each loop iteration, which affects memory
-requirements). Default: C<8192>.
+The initial read block size, the number of bytes this module will try to
+read during each loop iteration. Each handle object will consume at least
+this amount of memory for the read buffer as well, so when handling many
+connections requirements). See also C<max_read_size>. Default: C<2048>.
+
+=item max_read_size => <bytes>
+
+The maximum read buffer size used by the dynamic adjustment
+algorithm: Each time AnyEvent::Handle can read C<read_size> bytes in
+one go it will double C<read_size> up to the maximum given by this
+option. Default: C<131072> or C<read_size>, whichever is higher.
 
 =item low_water_mark => <bytes>
 
@@ -414,8 +424,9 @@
 =item tls_ctx => $anyevent_tls
 
 Use the given C<AnyEvent::TLS> object to create the new TLS connection
-(unless a connection object was specified directly). If this parameter is
-missing, then AnyEvent::Handle will use C<AnyEvent::Handle::TLS_CTX>.
+(unless a connection object was specified directly). If this
+parameter is missing (or C<undef>), then AnyEvent::Handle will use
+C<AnyEvent::Handle::TLS_CTX>.
 
 Instead of an object, you can also specify a hash reference with C<< key
 => value >> pairs. Those will be passed to L<AnyEvent::TLS> to create a
@@ -493,6 +504,8 @@
                $self->{connect}[1],
                sub {
                   my ($fh, $host, $port, $retry) = @_;
+
+                  delete $self->{_connect}; # no longer needed
 
                   if ($fh) {
                      $self->{fh} = $fh;
@@ -547,6 +560,10 @@
    $self->{_activity}  =
    $self->{_ractivity} =
    $self->{_wactivity} = AE::now;
+
+   $self->{read_size} ||= 2048;
+   $self->{max_read_size} = $self->{read_size}
+      if $self->{read_size} > ($self->{max_read_size} || MAX_READ_SIZE);
 
    $self->timeout   (delete $self->{timeout}  ) if $self->{timeout};
    $self->rtimeout  (delete $self->{rtimeout} ) if $self->{rtimeout};
@@ -1747,7 +1764,7 @@
 
       $self->{_rw} = AE::io $self->{fh}, 0, sub {
          my $rbuf = \($self->{tls} ? my $buf : $self->{rbuf});
-         my $len = sysread $self->{fh}, $$rbuf, $self->{read_size} || 8192, length $$rbuf;
+         my $len = sysread $self->{fh}, $$rbuf, $self->{read_size}, length $$rbuf;
 
          if ($len > 0) {
             $self->{_activity} = $self->{_ractivity} = AE::now;
@@ -1758,6 +1775,12 @@
                &_dotls ($self);
             } else {
                $self->_drain_rbuf;
+            }
+
+            if ($len == $self->{read_size}) {
+               $self->{read_size} *= 2;
+               $self->{read_size} = $self->{max_read_size} || MAX_READ_SIZE
+                  if $self->{read_size} > ($self->{max_read_size} || MAX_READ_SIZE);
             }
 
          } elsif (defined $len) {
@@ -2008,7 +2031,7 @@
 
          if ($len > 0) {
             substr $wbuf, 0, $len, "";
-         } else {
+         } elsif (defined $len || ($! != EAGAIN && $! != EINTR && $! != WSAEWOULDBLOCK)) {
             @linger = (); # end
          }
       };
@@ -2114,6 +2137,86 @@
 from within all other callbacks, you need to explicitly call the C<<
 ->destroy >> method.
 
+=item Why is my C<on_eof> callback never called?
+
+Probably because your C<on_error> callback is being called instead: When
+you have outstanding requests in your read queue, then an EOF is
+considered an error as you clearly expected some data.
+
+To avoid this, make sure you have an empty read queue whenever your handle
+is supposed to be "idle" (i.e. connection closes are O.K.). You cna set
+an C<on_read> handler that simply pushes the first read requests in the
+queue.
+
+See also the next question, which explains this in a bit more detail.
+
+=item How can I serve requests in a loop?
+
+Most protocols consist of some setup phase (authentication for example)
+followed by a request handling phase, where the server waits for requests
+and handles them, in a loop.
+
+There are two important variants: The first (traditional, better) variant
+handles requests until the server gets some QUIT command, causing it to
+close the connection first (highly desirable for a busy TCP server). A
+client dropping the connection is an error, which means this variant can
+detect an unexpected detection close.
+
+To handle this case, always make sure you have a on-empty read queue, by
+pushing the "read request start" handler on it:
+
+   # we assume a request starts with a single line
+   my @start_request; @start_request = (line => sub {
+      my ($hdl, $line) = @_;
+
+      ... handle request
+
+      # push next request read, possibly from a nested callback
+      $hdl->push_read (@start_request);
+   });
+
+   # auth done, now go into request handling loop
+   # now push the first @start_request
+   $hdl->push_read (@start_request);
+
+By always having an outstanding C<push_read>, the handle always expects
+some data and raises the C<EPIPE> error when the connction is dropped
+unexpectedly.
+
+The second variant is a protocol where the client can drop the connection
+at any time. For TCP, this means that the server machine may run out of
+sockets easier, and in general, it means you cnanot distinguish a protocl
+failure/client crash from a normal connection close. Nevertheless, these
+kinds of protocols are common (and sometimes even the best solution to the
+problem).
+
+Having an outstanding read request at all times is possible if you ignore
+C<EPIPE> errors, but this doesn't help with when the client drops the
+connection during a request, which would still be an error.
+
+A better solution is to push the initial request read in an C<on_read>
+callback. This avoids an error, as when the server doesn't expect data
+(i.e. is idly waiting for the next request, an EOF will not raise an
+error, but simply result in an C<on_eof> callback. It is also a bit slower
+and simpler:
+
+   # auth done, now go into request handling loop
+   $hdl->on_read (sub {
+      my ($hdl) = @_;
+
+      # called each time we receive data but the read queue is empty
+      # simply start read the request
+
+      $hdl->push_read (line => sub {
+         my ($hdl, $line) = @_;
+
+         ... handle request
+
+         # do nothing special when the request has been handled, just
+         # let the request queue go empty.
+      });
+   });
+
 =item I get different callback invocations in TLS mode/Why can't I pause
 reading?
 

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=65751&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Impl/EV.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Impl/EV.pm Sat Dec 11 15:35:02 2010
@@ -15,12 +15,17 @@
 do anything to make EV work with AnyEvent except by loading EV before
 creating the first AnyEvent watcher.
 
+EV is the fastest event library for perl, and best supported by
+AnyEvent. Most functions from the L<AE> API are implemented as direct
+aliases to EV functions, so using EV via AE is as fast as using EV
+directly.
+
 =cut
 
 package AnyEvent::Impl::EV;
 
 use AnyEvent (); BEGIN { AnyEvent::common_sense }
-use EV 3.44;
+use EV 4.00;
 
 # cannot override directly, as EV doesn't allow arguments
 sub time       { EV::time       }
@@ -39,7 +44,7 @@
    EV::timer $arg{after}, $arg{interval}, $arg{cb}
 }
 
-*AE::io = defined &EV::_ae_io # 3.8
+*AE::io = defined &EV::_ae_io # 3.8+, but keep just in case it is dropped
    ? \&EV::_ae_io
    : sub($$$) { EV::io $_[0], $_[1] ? EV::WRITE : EV::READ, $_[2] };
 
@@ -79,11 +84,11 @@
 *AE::idle = \&EV::idle;
 
 sub one_event {
-   EV::loop EV::LOOP_ONESHOT;
+   EV::run EV::RUN_ONCE;
 }
 
 sub loop {
-   EV::loop;
+   EV::run;
 }
 
 1;

Modified: trunk/libanyevent-perl/lib/AnyEvent/Impl/Irssi.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Impl/Irssi.pm?rev=65751&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Impl/Irssi.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Impl/Irssi.pm Sat Dec 11 15:35:02 2010
@@ -32,7 +32,8 @@
 
 =item * Artificial timer delays.
 
-Irssi artificially enforces timers to have at least a 10ms delay.
+Irssi artificially enforces timers to have at least a 10ms delay (by
+croaking, even).
 
 This means that some applications will be limited to a rate of 100Hz (for
 example, L<Coro::AnyEvent> thread scheduling).

Modified: trunk/libanyevent-perl/lib/AnyEvent/Impl/Tk.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Impl/Tk.pm?rev=65751&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Impl/Tk.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Impl/Tk.pm Sat Dec 11 15:35:02 2010
@@ -25,15 +25,17 @@
 
 I regularly run out of words to describe how bad it really is.
 
-To work around the many, many bugs in Tk that don't get fixed, this
-adaptor dup()'s all filehandles that get passed into its I/O watchers,
-so if you register a read and a write watcher for one fh, AnyEvent will
-create two additional file descriptors (and handles).
+To work around some of the many, many bugs in Tk that don't get fixed,
+this adaptor dup()'s all filehandles that get passed into its I/O
+watchers, so if you register a read and a write watcher for one fh,
+AnyEvent will create two additional file descriptors (and handles).
 
 This creates a high overhead and is slow, but seems to work around most
 known bugs in L<Tk::fileevent> on 32 bit architectures (Tk seems to be
 terminally broken on 64 bit, do not expect more than 10 or so watchers to
 work on 64 bit machines).
+
+Do not expect these workarounds to avoid segfaults and crashes inside Tk.
 
 Note also that Tk event ids wrap around after 2**32 or so events, which on
 my machine can happen within less than 12 hours, after which Tk will stomp
@@ -56,6 +58,8 @@
 our $mw = new MainWindow;
 $mw->withdraw;
 
+END { undef $mw }
+
 sub io {
    my (undef, %arg) = @_;
 
@@ -76,9 +80,12 @@
    my ($fh, $tk) = @{$_[0]};
 
    # work around another bug: watchers don't get removed when
-   # the fh is closed contrary to documentation. also, trying
+   # the fh is closed, contrary to documentation. also, trying
    # to unregister a read callback will make it impossible
    # to remove the write callback.
+   # if your program segfaults here then you need to destroy
+   # your watchers before program exit. sorry, no way around
+   # that.
    $mw->fileevent ($fh, $tk => "");
 }
 

Modified: trunk/libanyevent-perl/lib/AnyEvent/Intro.pod
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Intro.pod?rev=65751&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Intro.pod (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Intro.pod Sat Dec 11 15:35:02 2010
@@ -251,7 +251,7 @@
    # now wait until the name is available:
    $name_ready->recv;
 
-   undef $wait_for_input; # watche rno longer needed
+   undef $wait_for_input; # watcher no longer needed
 
    print "your name is $name\n";
 
@@ -288,7 +288,7 @@
    # now wait and fetch the name
    my $name = $name_ready->recv;
 
-   undef $wait_for_input; # watche rno longer needed
+   undef $wait_for_input; # watcher no longer needed
 
    print "your name is $name\n";
 

Modified: trunk/libanyevent-perl/lib/AnyEvent/Strict.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Strict.pm?rev=65751&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Strict.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Strict.pm Sat Dec 11 15:35:02 2010
@@ -15,9 +15,12 @@
 expense of being slower (often the argument checking takes longer than the
 actual function).
 
+B<< Currently, only AnyEvent I<methods> are checked, the AE:: I<functions> are not
+affected. >>
+
 Normally, you don't load this module yourself but instead use it
 indirectly via the C<PERL_ANYEVENT_STRICT> environment variable (see
-L<AnyEvent>). However, this module can be loaded at any time.
+L<AnyEvent>). However, this module can be loaded manually at any time.
 
 =cut
 
@@ -34,7 +37,7 @@
    # # and link us in before it in the chain.
    my $MODEL = shift @AnyEvent::ISA;
    unshift @ISA, $MODEL;
-   unshift @AnyEvent::ISA, AnyEvent::Strict::
+   unshift @AnyEvent::ISA, AnyEvent::Strict::;
 };
 
 sub io {

Modified: trunk/libanyevent-perl/t/08_idna.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/t/08_idna.t?rev=65751&op=diff
==============================================================================
--- trunk/libanyevent-perl/t/08_idna.t (original)
+++ trunk/libanyevent-perl/t/08_idna.t Sat Dec 11 15:35:02 2010
@@ -5,16 +5,16 @@
 
 print "ok 1\n";
 
-print "ko-eka" eq (AnyEvent::Util::punycode_encode "öko" ) ? "" : "not ", "ok 2\n";
-print "wgv71a" eq (AnyEvent::Util::punycode_encode "日本") ? "" : "not ", "ok 3\n";
+print "ko-eka" eq (AnyEvent::Util::punycode_encode "\x{f6}ko" ) ? "" : "not ", "ok 2\n";
+print "wgv71a" eq (AnyEvent::Util::punycode_encode "\x{65e5}\x{672c}") ? "" : "not ", "ok 3\n";
 
-print "öko"  eq (AnyEvent::Util::punycode_decode "ko-eka") ? "" : "not ", "ok 4\n";
-print "日本" eq (AnyEvent::Util::punycode_decode "wgv71a") ? "" : "not ", "ok 5\n";
+print "\x{f6}ko"  eq (AnyEvent::Util::punycode_decode "ko-eka") ? "" : "not ", "ok 4\n";
+print "\x{65e5}\x{672c}" eq (AnyEvent::Util::punycode_decode "wgv71a") ? "" : "not ", "ok 5\n";
 
-print "www.xn--ko-eka.eu"   eq (AnyEvent::Util::idn_to_ascii "www.öko.eu"  ) ? "" : "not ", "ok 6\n";
-print "xn--1-jn6bt1b.co.jp" eq (AnyEvent::Util::idn_to_ascii "日本1.co.jp" ) ? "" : "not ", "ok 7\n";
+print "www.xn--ko-eka.eu"   eq (AnyEvent::Util::idn_to_ascii "www.\x{f6}ko.eu"  ) ? "" : "not ", "ok 6\n";
+print "xn--1-jn6bt1b.co.jp" eq (AnyEvent::Util::idn_to_ascii "\x{65e5}\x{672c}1.co.jp" ) ? "" : "not ", "ok 7\n";
 print "xn--tda.com"         eq (AnyEvent::Util::idn_to_ascii "xn--tda.com" ) ? "" : "not ", "ok 8\n";
 print "xn--a-ecp.ru"        eq (AnyEvent::Util::idn_to_ascii "xn--a-ecp.ru") ? "" : "not ", "ok 9\n";
-print "xn--wgv71a119e.jp"   eq (AnyEvent::Util::idn_to_ascii "日本語。JP") ? "" : "not ", "ok 10\n";
+print "xn--wgv71a119e.jp"   eq (AnyEvent::Util::idn_to_ascii "\x{65e5}\x{672c}\x{8a9e}\x{3002}\x{ff2a}\x{ff30}") ? "" : "not ", "ok 10\n";
 
 print "ok 11\n";




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