r40294 - in /trunk/libio-async-perl: ./ debian/ examples/ lib/IO/ lib/IO/Async/ lib/IO/Async/Loop/ t/

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Mon Jul 20 14:53:38 UTC 2009


Author: jawnsy-guest
Date: Mon Jul 20 14:53:30 2009
New Revision: 40294

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=40294
Log:
* New upstream release
  + Added new tcp-proxy.pl example
  + Don't test Async::MergePoint locally anymore

Added:
    trunk/libio-async-perl/LICENSE
      - copied unchanged from r40249, branches/upstream/libio-async-perl/current/LICENSE
    trunk/libio-async-perl/README
      - copied unchanged from r40249, branches/upstream/libio-async-perl/current/README
    trunk/libio-async-perl/examples/tcp-proxy.pl
      - copied unchanged from r40249, branches/upstream/libio-async-perl/current/examples/tcp-proxy.pl
    trunk/libio-async-perl/t/99pod.t
      - copied unchanged from r40249, branches/upstream/libio-async-perl/current/t/99pod.t
Removed:
    trunk/libio-async-perl/t/01mergepoint.t
Modified:
    trunk/libio-async-perl/Build.PL
    trunk/libio-async-perl/Changes
    trunk/libio-async-perl/MANIFEST
    trunk/libio-async-perl/META.yml
    trunk/libio-async-perl/debian/changelog
    trunk/libio-async-perl/lib/IO/Async.pm
    trunk/libio-async-perl/lib/IO/Async/ChildManager.pm
    trunk/libio-async-perl/lib/IO/Async/Connector.pm
    trunk/libio-async-perl/lib/IO/Async/DetachedCode.pm
    trunk/libio-async-perl/lib/IO/Async/Handle.pm
    trunk/libio-async-perl/lib/IO/Async/Listener.pm
    trunk/libio-async-perl/lib/IO/Async/Loop.pm
    trunk/libio-async-perl/lib/IO/Async/Loop/IO_Poll.pm
    trunk/libio-async-perl/lib/IO/Async/Loop/Select.pm
    trunk/libio-async-perl/lib/IO/Async/MergePoint.pm
    trunk/libio-async-perl/lib/IO/Async/Notifier.pm
    trunk/libio-async-perl/lib/IO/Async/Resolver.pm
    trunk/libio-async-perl/lib/IO/Async/Sequencer.pm
    trunk/libio-async-perl/lib/IO/Async/Signal.pm
    trunk/libio-async-perl/lib/IO/Async/Stream.pm
    trunk/libio-async-perl/lib/IO/Async/Test.pm
    trunk/libio-async-perl/lib/IO/Async/Timer.pm

Modified: trunk/libio-async-perl/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/Build.PL?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/Build.PL (original)
+++ trunk/libio-async-perl/Build.PL Mon Jul 20 14:53:30 2009
@@ -22,6 +22,8 @@
                },
    license => 'perl',
    create_makefile_pl => 'traditional',
+   create_license => 1,
+   create_readme  => 1,
   );
 
 $build->create_build_script;

Modified: trunk/libio-async-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/Changes?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/Changes (original)
+++ trunk/libio-async-perl/Changes Mon Jul 20 14:53:30 2009
@@ -1,4 +1,14 @@
 Revision history for IO-Async
+
+0.22    CHANGES:
+         * Added tcp-proxy.pl example
+         * More documentation on IO::Async::Notifier subclass-override methods
+         * Documented that IO::Async::MergePoint is just an Async::MergePoint
+         * Various small updates to keep CPANTS happy
+
+        BUGFIXES:
+         * Don't test Async::MergePoint locally as it's now a separate dist,
+           and the tests here were reporting false negatives.
 
 0.21    CHANGES:
          * Added "use warnings" to all modules

Modified: trunk/libio-async-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/MANIFEST?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/MANIFEST (original)
+++ trunk/libio-async-perl/MANIFEST Mon Jul 20 14:53:30 2009
@@ -3,6 +3,7 @@
 examples/chat-server.pl
 examples/echo-server.pl
 examples/netcat-client.pl
+examples/tcp-proxy.pl
 examples/whoami-server.pl
 lib/IO/Async.pm
 lib/IO/Async/ChildManager.pm
@@ -25,11 +26,12 @@
 lib/IO/Async/Stream.pm
 lib/IO/Async/Test.pm
 lib/IO/Async/Timer.pm
+LICENSE
 Makefile.PL
 MANIFEST			This list of files
 META.yml
+README
 t/00use.t
-t/01mergepoint.t
 t/01timequeue.t
 t/02loop-magic.t
 t/03loop-osabstract.t
@@ -60,4 +62,5 @@
 t/52loop-listen.t
 t/60sequencer-client.t
 t/60sequencer-server.t
+t/99pod.t
 t/StupidLoop.pm

Modified: trunk/libio-async-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/META.yml?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/META.yml (original)
+++ trunk/libio-async-perl/META.yml Mon Jul 20 14:53:30 2009
@@ -1,11 +1,9 @@
 ---
 name: IO-Async
-version: 0.21
+version: 0.22
 author:
-  - 'Paul Evans E<lt>leonerd at leonerd.org.ukE<gt>'
-abstract: |-
-  a collection of modules that implement asynchronous filehandle
-  IO
+  - 'Paul Evans <leonerd at leonerd.org.uk>'
+abstract: perform asynchronous filehandle IO and other operations
 license: perl
 resources:
   license: http://dev.perl.org/licenses/
@@ -24,55 +22,55 @@
 provides:
   IO::Async:
     file: lib/IO/Async.pm
-    version: 0.21
+    version: 0.22
   IO::Async::ChildManager:
     file: lib/IO/Async/ChildManager.pm
-    version: 0.21
+    version: 0.22
   IO::Async::Connector:
     file: lib/IO/Async/Connector.pm
-    version: 0.21
+    version: 0.22
   IO::Async::DetachedCode:
     file: lib/IO/Async/DetachedCode.pm
-    version: 0.21
+    version: 0.22
   IO::Async::Handle:
     file: lib/IO/Async/Handle.pm
-    version: 0.21
+    version: 0.22
   IO::Async::Listener:
     file: lib/IO/Async/Listener.pm
-    version: 0.21
+    version: 0.22
   IO::Async::Loop:
     file: lib/IO/Async/Loop.pm
-    version: 0.21
+    version: 0.22
   IO::Async::Loop::IO_Poll:
     file: lib/IO/Async/Loop/IO_Poll.pm
-    version: 0.21
+    version: 0.22
   IO::Async::Loop::Select:
     file: lib/IO/Async/Loop/Select.pm
-    version: 0.21
+    version: 0.22
   IO::Async::MergePoint:
     file: lib/IO/Async/MergePoint.pm
-    version: 0.21
+    version: 0.22
   IO::Async::Notifier:
     file: lib/IO/Async/Notifier.pm
-    version: 0.21
+    version: 0.22
   IO::Async::Resolver:
     file: lib/IO/Async/Resolver.pm
-    version: 0.21
+    version: 0.22
   IO::Async::Sequencer:
     file: lib/IO/Async/Sequencer.pm
-    version: 0.21
+    version: 0.22
   IO::Async::Signal:
     file: lib/IO/Async/Signal.pm
-    version: 0.21
+    version: 0.22
   IO::Async::Stream:
     file: lib/IO/Async/Stream.pm
-    version: 0.21
+    version: 0.22
   IO::Async::Test:
     file: lib/IO/Async/Test.pm
-    version: 0.21
+    version: 0.22
   IO::Async::Timer:
     file: lib/IO/Async/Timer.pm
-    version: 0.21
+    version: 0.22
 generated_by: Module::Build version 0.33
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html

Modified: trunk/libio-async-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/debian/changelog?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/debian/changelog (original)
+++ trunk/libio-async-perl/debian/changelog Mon Jul 20 14:53:30 2009
@@ -1,8 +1,13 @@
-libio-async-perl (0.21-2) UNRELEASED; urgency=low
+libio-async-perl (0.22-1) UNRELEASED; urgency=low
 
+  * New upstream release
+    + Added new tcp-proxy.pl example
+    + Don't test Async::MergePoint locally anymore
+
+  [ Nathan Handler ]
   * debian/watch: Update to ignore development releases.
 
- -- Nathan Handler <nhandler at ubuntu.com>  Sat, 06 Jun 2009 01:34:35 +0000
+ -- Jonathan Yu <frequency at cpan.org>  Sun, 19 Jul 2009 20:02:57 -0400
 
 libio-async-perl (0.21-1) unstable; urgency=low
 

Modified: trunk/libio-async-perl/lib/IO/Async.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/lib/IO/Async.pm?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/lib/IO/Async.pm (original)
+++ trunk/libio-async-perl/lib/IO/Async.pm Mon Jul 20 14:53:30 2009
@@ -12,12 +12,11 @@
 # It is provided simply to keep CPAN happy:
 #   cpan -i IO::Async
 
-our $VERSION = '0.21';
+our $VERSION = '0.22';
 
 =head1 NAME
 
-C<IO::Async> - a collection of modules that implement asynchronous filehandle
-IO
+C<IO::Async> - perform asynchronous filehandle IO and other operations
 
 =head1 SYNOPSIS
 
@@ -225,7 +224,7 @@
 
 =head1 AUTHOR
 
-Paul Evans E<lt>leonerd at leonerd.org.ukE<gt>
+Paul Evans <leonerd at leonerd.org.uk>
 
 =cut
 

Modified: trunk/libio-async-perl/lib/IO/Async/ChildManager.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/lib/IO/Async/ChildManager.pm?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/lib/IO/Async/ChildManager.pm (original)
+++ trunk/libio-async-perl/lib/IO/Async/ChildManager.pm Mon Jul 20 14:53:30 2009
@@ -8,7 +8,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.21';
+our $VERSION = '0.22';
 
 # Not a notifier
 
@@ -929,26 +929,31 @@
       if( $key =~  m/^fd\d+$/ ) {
          ref $value eq "HASH" or croak "Expected '$orig_key' to be a HASH ref";
 
-         my ( $pipe_r, $pipe_w ) = $loop->pipepair() or croak "Unable to pipe() - $!";
-
-         my ( $myfd, $childfd );
+         my $op;
 
          if( exists $value->{on_read} ) {
             ref $value->{on_read} eq "CODE" or croak "Expected 'on_read' for '$orig_key' be a CODE ref";
             scalar keys %$value == 1 or croak "Found other keys than 'on_read' for '$orig_key'";
 
-            $myfd    = $pipe_r;
-            $childfd = $pipe_w;
+            $op = "pipe_read";
          }
          elsif( exists $value->{from} ) {
             ref $value->{from} eq "" or croak "Expected 'from' for '$orig_key' not to be a reference";
             scalar keys %$value == 1 or croak "Found other keys than 'from' for '$orig_key'";
 
-            $myfd    = $pipe_w;
-            $childfd = $pipe_r;
+            $op = "pipe_write";
          }
          else {
             croak "Cannot recognise what to do with '$orig_key'";
+         }
+
+         my ( $myfd, $childfd );
+
+         if( $op eq "pipe_read" ) {
+            ( $myfd, $childfd ) = $loop->pipepair() or croak "Unable to pipe() - $!";
+         }
+         elsif( $op eq "pipe_write" ) {
+            ( $childfd, $myfd ) = $loop->pipepair() or croak "Unable to pipe() - $!";
          }
 
          $filehandles{$key} = [ $myfd, $childfd, $value ];
@@ -1144,4 +1149,4 @@
 
 =head1 AUTHOR
 
-Paul Evans E<lt>leonerd at leonerd.org.ukE<gt>
+Paul Evans <leonerd at leonerd.org.uk>

Modified: trunk/libio-async-perl/lib/IO/Async/Connector.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/lib/IO/Async/Connector.pm?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/lib/IO/Async/Connector.pm (original)
+++ trunk/libio-async-perl/lib/IO/Async/Connector.pm Mon Jul 20 14:53:30 2009
@@ -8,7 +8,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.21';
+our $VERSION = '0.22';
 
 use POSIX qw( EINPROGRESS );
 use Socket qw( SOL_SOCKET SO_ERROR );
@@ -356,4 +356,4 @@
 
 =head1 AUTHOR
 
-Paul Evans E<lt>leonerd at leonerd.org.ukE<gt>
+Paul Evans <leonerd at leonerd.org.uk>

Modified: trunk/libio-async-perl/lib/IO/Async/DetachedCode.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/lib/IO/Async/DetachedCode.pm?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/lib/IO/Async/DetachedCode.pm (original)
+++ trunk/libio-async-perl/lib/IO/Async/DetachedCode.pm Mon Jul 20 14:53:30 2009
@@ -8,7 +8,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.21';
+our $VERSION = '0.22';
 
 use IO::Async::Stream;
 
@@ -671,4 +671,4 @@
 
 =head1 AUTHOR
 
-Paul Evans E<lt>leonerd at leonerd.org.ukE<gt>
+Paul Evans <leonerd at leonerd.org.uk>

Modified: trunk/libio-async-perl/lib/IO/Async/Handle.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/lib/IO/Async/Handle.pm?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/lib/IO/Async/Handle.pm (original)
+++ trunk/libio-async-perl/lib/IO/Async/Handle.pm Mon Jul 20 14:53:30 2009
@@ -9,7 +9,7 @@
 use warnings;
 use base qw( IO::Async::Notifier );
 
-our $VERSION = '0.21';
+our $VERSION = '0.22';
 
 use Carp;
 use Scalar::Util qw( weaken );
@@ -493,4 +493,4 @@
 
 =head1 AUTHOR
 
-Paul Evans E<lt>leonerd at leonerd.org.ukE<gt>
+Paul Evans <leonerd at leonerd.org.uk>

Modified: trunk/libio-async-perl/lib/IO/Async/Listener.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/lib/IO/Async/Listener.pm?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/lib/IO/Async/Listener.pm (original)
+++ trunk/libio-async-perl/lib/IO/Async/Listener.pm Mon Jul 20 14:53:30 2009
@@ -8,7 +8,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.21';
+our $VERSION = '0.22';
 
 use IO::Async::Handle;
 
@@ -401,4 +401,4 @@
 
 =head1 AUTHOR
 
-Paul Evans E<lt>leonerd at leonerd.org.ukE<gt>
+Paul Evans <leonerd at leonerd.org.uk>

Modified: trunk/libio-async-perl/lib/IO/Async/Loop.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/lib/IO/Async/Loop.pm?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/lib/IO/Async/Loop.pm (original)
+++ trunk/libio-async-perl/lib/IO/Async/Loop.pm Mon Jul 20 14:53:30 2009
@@ -8,7 +8,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.21';
+our $VERSION = '0.22';
 
 use Carp;
 
@@ -1199,4 +1199,4 @@
 
 =head1 AUTHOR
 
-Paul Evans E<lt>leonerd at leonerd.org.ukE<gt>
+Paul Evans <leonerd at leonerd.org.uk>

Modified: trunk/libio-async-perl/lib/IO/Async/Loop/IO_Poll.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/lib/IO/Async/Loop/IO_Poll.pm?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/lib/IO/Async/Loop/IO_Poll.pm (original)
+++ trunk/libio-async-perl/lib/IO/Async/Loop/IO_Poll.pm Mon Jul 20 14:53:30 2009
@@ -8,7 +8,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.21';
+our $VERSION = '0.22';
 
 use base qw( IO::Async::Loop );
 
@@ -273,4 +273,4 @@
 
 =head1 AUTHOR
 
-Paul Evans E<lt>leonerd at leonerd.org.ukE<gt>
+Paul Evans <leonerd at leonerd.org.uk>

Modified: trunk/libio-async-perl/lib/IO/Async/Loop/Select.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/lib/IO/Async/Loop/Select.pm?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/lib/IO/Async/Loop/Select.pm (original)
+++ trunk/libio-async-perl/lib/IO/Async/Loop/Select.pm Mon Jul 20 14:53:30 2009
@@ -8,7 +8,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.21';
+our $VERSION = '0.22';
 
 use base qw( IO::Async::Loop );
 
@@ -261,4 +261,4 @@
 
 =head1 AUTHOR
 
-Paul Evans E<lt>leonerd at leonerd.org.ukE<gt>
+Paul Evans <leonerd at leonerd.org.uk>

Modified: trunk/libio-async-perl/lib/IO/Async/MergePoint.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/lib/IO/Async/MergePoint.pm?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/lib/IO/Async/MergePoint.pm (original)
+++ trunk/libio-async-perl/lib/IO/Async/MergePoint.pm Mon Jul 20 14:53:30 2009
@@ -1,14 +1,14 @@
 #  You may distribute under the terms of either the GNU General Public License
 #  or the Artistic License (the same terms as Perl itself)
 #
-#  (C) Paul Evans, 2007 -- leonerd at leonerd.org.uk
+#  (C) Paul Evans, 2007,2009 -- leonerd at leonerd.org.uk
 
 package IO::Async::MergePoint;
 
 use strict;
 use warnings;
 
-our $VERSION = '0.21';
+our $VERSION = '0.22';
 
 use Carp;
 
@@ -20,9 +20,15 @@
 
 =head1 SYNOPSIS
 
- use IO::Async::MergePoint;
+This module as now been moved to its own dist of L<Async::MergePoint>.
 
- my $merge = IO::Async::MergePoint->new(
+It is kept here as a trivial subclass for backward compatibilty. Eventually
+this subclass may be removed. Any code using C<IO::Async::MergePoint> should
+instead use L<Async::MergePoint>.
+
+ use Async::MergePoint;
+
+ my $merge = Async::MergePoint->new(
     needs => [ "leaves", "water" ],
 
     on_finished => sub {
@@ -48,9 +54,9 @@
 
 An C<IO::Async>-based program could do this, but if each step involves some IO
 idle time, better overall performance can often be gained by running the steps
-in parallel. A C<IO::Async::MergePoint> object can then be used to wait for
-all of the steps to complete, before passing the combined result of each step
-on to the next stage.
+in parallel. A L<Async::MergePoint> object can then be used to wait for all of
+the steps to complete, before passing the combined result of each step on to
+the next stage.
 
 A merge point maintains a set of outstanding operations it is waiting on;
 these are arbitrary string values provided at the object's construction. Each
@@ -64,53 +70,6 @@
 
 =cut
 
-=head1 CONSTRUCTOR
-
-=cut
-
-=head2 $merge = IO::Async::MergePoint->new( %params )
-
-This function returns a new instance of a C<IO::Async::MergePoint> object. The
-C<%params> hash takes the following keys:
-
-=over 8
-
-=item needs => ARRAY
-
-An array containing unique item names to wait on. The order of this array is
-not significant.
-
-=item on_finished => CODE
-
-CODE reference to the continuation for when the merge point becomes ready.
-
-=back
-
-The C<on_finished> continuation will be called when every key in the C<needs>
-list has been notified by the C<done()> method. It will be called as
-
- $on_finished->( %items )
-
-where the C<%items> hash will contain the item names that were waited on, and
-the values passed to the C<done()> method for each one. Note that this is
-passed as a list, not as a HASH reference.
-
-=cut
-
-=head1 METHODS
-
-=cut
-
-=head2 $merge->done( $item, $value )
-
-This method informs the merge point that the C<$item> is now ready, and
-passes it a value to store, to be passed into the C<on_finished> continuation.
-If this call gives the final remaining item being waited for, the
-C<on_finished> continuation is called within it, and the method will not
-return until it has completed.
-
-=cut
-
 # Keep perl happy; keep Britain tidy
 1;
 
@@ -118,4 +77,4 @@
 
 =head1 AUTHOR
 
-Paul Evans E<lt>leonerd at leonerd.org.ukE<gt>
+Paul Evans <leonerd at leonerd.org.uk>

Modified: trunk/libio-async-perl/lib/IO/Async/Notifier.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/lib/IO/Async/Notifier.pm?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/lib/IO/Async/Notifier.pm (original)
+++ trunk/libio-async-perl/lib/IO/Async/Notifier.pm Mon Jul 20 14:53:30 2009
@@ -8,7 +8,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.21';
+our $VERSION = '0.22';
 
 use Carp;
 use Scalar::Util qw( weaken );
@@ -165,11 +165,6 @@
    return $self;
 }
 
-# for subclasses to override
-sub _init
-{
-}
-
 =head2 $notifier->configure( %params )
 
 Adjust the named parameters of the C<Notifier> as given by the C<%params>
@@ -200,15 +195,6 @@
 {
    my $self = shift;
    return $self->{loop}
-}
-
-# for subclasses to override
-sub _add_to_loop
-{
-}
-
-sub _remove_from_loop
-{
 }
 
 # Only called by IO::Async::Loop, not external interface
@@ -324,6 +310,76 @@
    }
 }
 
+=head1 SUBCLASS METHODS
+
+C<IO::Async::Notifier> is a base class provided so that specific subclasses of
+it provide more specific behaviour. The base class provides a number of
+methods that subclasses may wish to override.
+
+If a subclass implements any of these, be sure to invoke the superclass method
+at some point within the code.
+
+=cut
+
+=head2 $notifier->_init( $paramsref )
+
+This method is called by the constructor just before calling C<configure()>.
+It is passed a reference to the HASH storing the constructor arguments.
+
+This method may initialise internal details of the Notifier as required,
+possibly by using parameters from the HASH. If any parameters are
+construction-only they should be C<delete>d from the hash.
+
+=cut
+
+sub _init
+{
+   # empty default
+}
+
+=head2 $notifier->configure( %params )
+
+This method is called by the constructor to set the initial values of named
+parameters, and by users of the object to adjust the values once constructed.
+
+This method should C<delete> from the C<%params> hash any keys it has dealt
+with, then pass the remaining ones to the C<SUPER::configure()>. The base
+class implementation will throw an exception if there are any unrecognised
+keys remaining.
+
+=cut
+
+=head2 $notifier->_add_to_loop( $loop )
+
+This method is called when the Notifier has been added to a Loop; either
+directly, or indirectly through being a child of a Notifer already in a loop.
+
+This method may be used to perform any initial startup activity required for
+the Notifier to be fully functional but which requires a Loop to do so.
+
+=cut
+
+sub _add_to_loop
+{
+   # empty default
+}
+
+=head2 $notifier->_remove_from_loop( $loop )
+
+This method is called when the Notifier has been removed from a Loop; either
+directly, or indirectly through being a child of a Notifier removed from the
+loop.
+
+This method may be used to undo the effects of any setup that the
+C<_add_to_loop> method had originally done.
+
+=cut
+
+sub _remove_from_loop
+{
+   # empty default
+}
+
 # Keep perl happy; keep Britain tidy
 1;
 
@@ -331,4 +387,4 @@
 
 =head1 AUTHOR
 
-Paul Evans E<lt>leonerd at leonerd.org.ukE<gt>
+Paul Evans <leonerd at leonerd.org.uk>

Modified: trunk/libio-async-perl/lib/IO/Async/Resolver.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/lib/IO/Async/Resolver.pm?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/lib/IO/Async/Resolver.pm (original)
+++ trunk/libio-async-perl/lib/IO/Async/Resolver.pm Mon Jul 20 14:53:30 2009
@@ -8,7 +8,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.21';
+our $VERSION = '0.22';
 
 use Socket::GetAddrInfo qw( :Socket6api getaddrinfo getnameinfo );
 
@@ -311,4 +311,4 @@
 
 =head1 AUTHOR
 
-Paul Evans E<lt>leonerd at leonerd.org.ukE<gt>
+Paul Evans <leonerd at leonerd.org.uk>

Modified: trunk/libio-async-perl/lib/IO/Async/Sequencer.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/lib/IO/Async/Sequencer.pm?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/lib/IO/Async/Sequencer.pm (original)
+++ trunk/libio-async-perl/lib/IO/Async/Sequencer.pm Mon Jul 20 14:53:30 2009
@@ -8,7 +8,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.21';
+our $VERSION = '0.22';
 
 use base qw( IO::Async::Stream );
 
@@ -198,23 +198,23 @@
 
 =cut
 
-sub new
-{
-   my $class = shift;
-   my %params = @_;
-
-   if(  defined $params{read_handle} and !defined $params{write_handle} or
-       !defined $params{read_handle} and  defined $params{write_handle} ) {
-      croak "Sequencer requires both a reading and a writing handle";
-   }
-
-   my $on_read = delete $params{on_read};
-   ref $on_read eq "CODE" or $class->can( "on_read" ) 
-      or croak "Expected 'on_read' as a CODE reference, or to be a class that can ->on_read";
-
-   return $class->SUPER::new(
-      %params,
-
+sub _init
+{
+   my $self = shift;
+   my ( $params ) = @_;
+
+   $self->{pipeline} = 1; # default on
+
+   # Queue to use in server mode - stores pending responses to be sent
+   $self->{server_queue} = []; # element is: $streamed_response
+
+   # Queue to use in client mode - stores pending on_response handlers to be called
+   $self->{client_queue} = []; # element is: [ $on_response, $delegated_on_read ]
+
+   my $on_read = delete $params->{on_read} || $self->can( "on_read" );
+
+   # Since our ->configure() has banned 'on_read', we need to call SUPER one from here
+   $self->SUPER::configure(
       on_read => sub {
          my ( $self, $buffref, $closed ) = @_;
 
@@ -237,28 +237,19 @@
          return 0 unless length $$buffref;
 
          # No delegation to perform, instead just call the provided one
-         goto &{ $on_read || $self->can( "on_read" ) };
+         goto &$on_read;
       },
    );
 }
 
-sub _init
-{
-   my $self = shift;
-
-   $self->{pipeline} = 1; # default on
-
-   # Queue to use in server mode - stores pending responses to be sent
-   $self->{server_queue} = []; # element is: $streamed_response
-
-   # Queue to use in client mode - stores pending on_response handlers to be called
-   $self->{client_queue} = []; # element is: [ $on_response, $delegated_on_read ]
-}
-
 sub configure
 {
    my $self = shift;
    my %params = @_;
+
+   if( exists $params{on_read} ) {
+      croak "Cannot modify 'on_read' of a " . __PACKAGE__;
+   }
 
    foreach (qw( marshall_request marshall_response on_request )) {
       $self->{$_} = delete $params{$_} if exists $params{$_};
@@ -589,4 +580,4 @@
 
 =head1 AUTHOR
 
-Paul Evans E<lt>leonerd at leonerd.org.ukE<gt>
+Paul Evans <leonerd at leonerd.org.uk>

Modified: trunk/libio-async-perl/lib/IO/Async/Signal.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/lib/IO/Async/Signal.pm?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/lib/IO/Async/Signal.pm (original)
+++ trunk/libio-async-perl/lib/IO/Async/Signal.pm Mon Jul 20 14:53:30 2009
@@ -9,7 +9,7 @@
 use warnings;
 use base qw( IO::Async::Notifier );
 
-our $VERSION = '0.21';
+our $VERSION = '0.22';
 
 use Carp;
 use Scalar::Util qw( weaken );
@@ -124,4 +124,4 @@
 
 =head1 AUTHOR
 
-Paul Evans E<lt>leonerd at leonerd.org.ukE<gt>
+Paul Evans <leonerd at leonerd.org.uk>

Modified: trunk/libio-async-perl/lib/IO/Async/Stream.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/lib/IO/Async/Stream.pm?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/lib/IO/Async/Stream.pm (original)
+++ trunk/libio-async-perl/lib/IO/Async/Stream.pm Mon Jul 20 14:53:30 2009
@@ -8,7 +8,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.21';
+our $VERSION = '0.22';
 
 use base qw( IO::Async::Handle );
 
@@ -548,4 +548,4 @@
 
 =head1 AUTHOR
 
-Paul Evans E<lt>leonerd at leonerd.org.ukE<gt>
+Paul Evans <leonerd at leonerd.org.uk>

Modified: trunk/libio-async-perl/lib/IO/Async/Test.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/lib/IO/Async/Test.pm?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/lib/IO/Async/Test.pm (original)
+++ trunk/libio-async-perl/lib/IO/Async/Test.pm Mon Jul 20 14:53:30 2009
@@ -8,7 +8,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.21';
+our $VERSION = '0.22';
 
 use Exporter;
 our @ISA = qw( Exporter );
@@ -22,7 +22,7 @@
 
 =head1 NAME
 
-C<IO::Async::Test> - Utility functions for use in test scripts
+C<IO::Async::Test> - utility functions for use in test scripts
 
 =head1 SYNOPSIS
 
@@ -175,4 +175,4 @@
 
 =head1 AUTHOR
 
-Paul Evans E<lt>leonerd at leonerd.org.ukE<gt>
+Paul Evans <leonerd at leonerd.org.uk>

Modified: trunk/libio-async-perl/lib/IO/Async/Timer.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-async-perl/lib/IO/Async/Timer.pm?rev=40294&op=diff
==============================================================================
--- trunk/libio-async-perl/lib/IO/Async/Timer.pm (original)
+++ trunk/libio-async-perl/lib/IO/Async/Timer.pm Mon Jul 20 14:53:30 2009
@@ -9,7 +9,7 @@
 use warnings;
 use base qw( IO::Async::Notifier );
 
-our $VERSION = '0.21';
+our $VERSION = '0.22';
 
 use Carp;
 use Scalar::Util qw( weaken );
@@ -231,4 +231,4 @@
 
 =head1 AUTHOR
 
-Paul Evans E<lt>leonerd at leonerd.org.ukE<gt>
+Paul Evans <leonerd at leonerd.org.uk>




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