r58962 - in /trunk/libanyevent-perl: Changes META.yml README debian/changelog lib/AnyEvent.pm lib/AnyEvent/Handle.pm lib/AnyEvent/Socket.pm
ansgar-guest at users.alioth.debian.org
ansgar-guest at users.alioth.debian.org
Sun Jun 6 13:15:55 UTC 2010
Author: ansgar-guest
Date: Sun Jun 6 13:15:04 2010
New Revision: 58962
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=58962
Log:
New upstream release.
Modified:
trunk/libanyevent-perl/Changes
trunk/libanyevent-perl/META.yml
trunk/libanyevent-perl/README
trunk/libanyevent-perl/debian/changelog
trunk/libanyevent-perl/lib/AnyEvent.pm
trunk/libanyevent-perl/lib/AnyEvent/Handle.pm
trunk/libanyevent-perl/lib/AnyEvent/Socket.pm
Modified: trunk/libanyevent-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/Changes?rev=58962&op=diff
==============================================================================
--- trunk/libanyevent-perl/Changes (original)
+++ trunk/libanyevent-perl/Changes Sun Jun 6 13:15:04 2010
@@ -1,6 +1,13 @@
Revision history for Perl extension AnyEvent.
-TODO: docs signal for condvar
+5.27 Sun Jun 6 12:12:05 CEST 2010
+ - postpone differently in AnyEvent::Socket now, as
+ when not, canceling the connection attempt might fail
+ (found by Felix Antonius Wilhelm Ostmann).
+ - explicitly check for non-stream sockets in AE::Handle, too many
+ clueless people fell into the trap of this somehow working.
+ - simplified and reworked the "OTHER MODULES" section.
+ - better/more condvar examples.
5.261 Wed Apr 28 16:13:36 CEST 2010
- AF_INET6 was not properly used from Socket6 during configuration
Modified: trunk/libanyevent-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/META.yml?rev=58962&op=diff
==============================================================================
--- trunk/libanyevent-perl/META.yml (original)
+++ trunk/libanyevent-perl/META.yml Sun Jun 6 13:15:04 2010
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: AnyEvent
-version: 5.261
+version: 5.27
abstract: ~
author: []
license: unknown
@@ -14,7 +14,7 @@
directory:
- t
- inc
-generated_by: ExtUtils::MakeMaker version 6.56
+generated_by: ExtUtils::MakeMaker version 6.55_02
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
Modified: trunk/libanyevent-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/README?rev=58962&op=diff
==============================================================================
--- trunk/libanyevent-perl/README (original)
+++ trunk/libanyevent-perl/README Sun Jun 6 13:15:04 2010
@@ -7,7 +7,7 @@
SYNOPSIS
use AnyEvent;
- # if you prefer function calls, look at the L<AE> manpage for
+ # if you prefer function calls, look at the AE manpage for
# an alternative API.
# file handle or descriptor readable
@@ -473,10 +473,10 @@
Example: fork a process and wait for it
my $done = AnyEvent->condvar;
-
- my $pid = fork or exit 5;
-
- my $w = AnyEvent->child (
+
+ my $pid = fork or exit 5;
+
+ my $w = AnyEvent->child (
pid => $pid,
cb => sub {
my ($pid, $status) = @_;
@@ -484,8 +484,8 @@
$done->send;
},
);
-
- # do something else, then wait for process exit
+
+ # do something else, then wait for process exit
$done->recv;
IDLE WATCHERS
@@ -541,8 +541,8 @@
event loop and will only block when necessary (usually when told by the
user).
- The instrument to do that is called a "condition variable", so called
- because they represent a condition that must become true.
+ The tool to do that is called a "condition variable", so called because
+ they represent a condition that must become true.
Now is probably a good time to look at the examples further below.
@@ -557,13 +557,27 @@
as if it were a callback, read about the caveats in the description for
the "->send" method).
- Condition variables are similar to callbacks, except that you can
- optionally wait for them. They can also be called merge points - points
- in time where multiple outstanding events have been processed. And yet
- another way to call them is transactions - each condition variable can
- be used to represent a transaction, which finishes at some point and
- delivers a result. And yet some people know them as "futures" - a
- promise to compute/deliver something that you can wait for.
+ Since condition variables are the most complex part of the AnyEvent API,
+ here are some different mental models of what they are - pick the ones
+ you can connect to:
+
+ * Condition variables are like callbacks - you can call them (and pass
+ them instead of callbacks). Unlike callbacks however, you can also
+ wait for them to be called.
+
+ * Condition variables are signals - one side can emit or send them,
+ the other side can wait for them, or install a handler that is
+ called when the signal fires.
+
+ * Condition variables are like "Merge Points" - points in your program
+ where you merge multiple independent results/control flows into one.
+
+ * Condition variables represent a transaction - function that start
+ some kind of transaction can return them, leaving the caller the
+ choice between waiting in a blocking fashion, or setting a callback.
+
+ * Condition variables represent future values, or promises to deliver
+ some result, long before the result is available.
Condition variables are very useful to signal that something has
finished, for example, if you write a module that does asynchronous http
@@ -1009,7 +1023,7 @@
The following is a non-exhaustive list of additional modules that use
AnyEvent as a client and can therefore be mixed easily with other
AnyEvent modules and other event loops in the same program. Some of the
- modules come with AnyEvent, most are available via CPAN.
+ modules come as part of AnyEvent, the others are available via CPAN.
AnyEvent::Util
Contains various utility functions that replace often-used but
@@ -1030,50 +1044,44 @@
AnyEvent::DNS
Provides rich asynchronous DNS resolver capabilities.
- AnyEvent::HTTP
- A simple-to-use HTTP library that is capable of making a lot of
- concurrent HTTP requests.
+ AnyEvent::HTTP, AnyEvent::IRC, AnyEvent::XMPP, AnyEvent::GPSD,
+ AnyEvent::IGS, AnyEvent::FCP
+ Implement event-based interfaces to the protocols of the same name
+ (for the curious, IGS is the International Go Server and FCP is the
+ Freenet Client Protocol).
+
+ AnyEvent::Handle::UDP
+ Here be danger!
+
+ As Pauli would put it, "Not only is it not right, it's not even
+ wrong!" - there are so many things wrong with AnyEvent::Handle::UDP,
+ most notably it's use of a stream-based API with a protocol that
+ isn't streamable, that the only way to improve it is to delete it.
+
+ It features data corruption (but typically only under load) and
+ general confusion. On top, the author is not only clueless about UDP
+ but also fact-resistant - some gems of his understanding: "connect
+ doesn't work with UDP", "UDP packets are not IP packets", "UDP only
+ has datagrams, not packets", "I don't need to implement proper error
+ checking as UDP doesn't support error checking" and so on - he
+ doesn't even understand what's wrong with his module when it is
+ explained to him.
+
+ AnyEvent::DBI
+ Executes DBI requests asynchronously in a proxy process for you,
+ notifying you in an event-bnased way when the operation is finished.
+
+ AnyEvent::AIO
+ Truly asynchronous (as opposed to non-blocking) I/O, should be in
+ the toolbox of every event programmer. AnyEvent::AIO transparently
+ fuses IO::AIO and AnyEvent together, giving AnyEvent access to
+ event-based file I/O, and much more.
AnyEvent::HTTPD
- Provides a simple web application server framework.
+ A simple embedded webserver.
AnyEvent::FastPing
The fastest ping in the west.
-
- AnyEvent::DBI
- Executes DBI requests asynchronously in a proxy process.
-
- AnyEvent::AIO
- Truly asynchronous I/O, should be in the toolbox of every event
- programmer. AnyEvent::AIO transparently fuses IO::AIO and AnyEvent
- together.
-
- AnyEvent::BDB
- Truly asynchronous Berkeley DB access. AnyEvent::BDB transparently
- fuses BDB and AnyEvent together.
-
- AnyEvent::GPSD
- A non-blocking interface to gpsd, a daemon delivering GPS
- information.
-
- AnyEvent::IRC
- AnyEvent based IRC client module family (replacing the older
- Net::IRC3).
-
- AnyEvent::XMPP
- AnyEvent based XMPP (Jabber protocol) module family (replacing the
- older Net::XMPP2>.
-
- AnyEvent::IGS
- A non-blocking interface to the Internet Go Server protocol (used by
- App::IGS).
-
- Net::FCP
- AnyEvent-based implementation of the Freenet Client Protocol,
- birthplace of AnyEvent.
-
- Event::ExecFlow
- High level API for event-based execution flow control.
Coro
Has special support for AnyEvent via Coro::AnyEvent.
@@ -1845,8 +1853,8 @@
before the first watcher gets created, e.g. with a "BEGIN" block:
BEGIN { delete $ENV{PERL_ANYEVENT_MODEL} }
-
- use AnyEvent;
+
+ use AnyEvent;
Similar considerations apply to $ENV{PERL_ANYEVENT_VERBOSE}, as that can
be used to probe what backend is used and gain other information (which
Modified: trunk/libanyevent-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/debian/changelog?rev=58962&op=diff
==============================================================================
--- trunk/libanyevent-perl/debian/changelog (original)
+++ trunk/libanyevent-perl/debian/changelog Sun Jun 6 13:15:04 2010
@@ -1,9 +1,8 @@
-libanyevent-perl (5.261-1) UNRELEASED; urgency=low
-
- IGNORE-VERSION: 5.261-1
- Changes to constants.pl.PL seem to be irrelevant on Debian.
-
- -- Ansgar Burchardt <ansgar at 43-1.org> Thu, 29 Apr 2010 18:09:54 +0900
+libanyevent-perl (5.270-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Ansgar Burchardt <ansgar at 43-1.org> Sun, 06 Jun 2010 22:13:37 +0900
libanyevent-perl (5.260-1) unstable; urgency=low
Modified: trunk/libanyevent-perl/lib/AnyEvent.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent.pm?rev=58962&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent.pm Sun Jun 6 13:15:04 2010
@@ -9,7 +9,7 @@
use AnyEvent;
- # if you prefer function calls, look at the L<AE> manpage for
+ # if you prefer function calls, look at the AE manpage for
# an alternative API.
# file handle or descriptor readable
@@ -558,8 +558,8 @@
AnyEvent is slightly different: it expects somebody else to run the event
loop and will only block when necessary (usually when told by the user).
-The instrument to do that is called a "condition variable", so called
-because they represent a condition that must become true.
+The tool to do that is called a "condition variable", so called because
+they represent a condition that must become true.
Now is probably a good time to look at the examples further below.
@@ -574,13 +574,29 @@
were a callback, read about the caveats in the description for the C<<
->send >> method).
-Condition variables are similar to callbacks, except that you can
-optionally wait for them. They can also be called merge points - points
-in time where multiple outstanding events have been processed. And yet
-another way to call them is transactions - each condition variable can be
-used to represent a transaction, which finishes at some point and delivers
-a result. And yet some people know them as "futures" - a promise to
-compute/deliver something that you can wait for.
+Since condition variables are the most complex part of the AnyEvent API, here are
+some different mental models of what they are - pick the ones you can connect to:
+
+=over 4
+
+=item * Condition variables are like callbacks - you can call them (and pass them instead
+of callbacks). Unlike callbacks however, you can also wait for them to be called.
+
+=item * Condition variables are signals - one side can emit or send them,
+the other side can wait for them, or install a handler that is called when
+the signal fires.
+
+=item * Condition variables are like "Merge Points" - points in your program
+where you merge multiple independent results/control flows into one.
+
+=item * Condition variables represent a transaction - function that start
+some kind of transaction can return them, leaving the caller the choice
+between waiting in a blocking fashion, or setting a callback.
+
+=item * Condition variables represent future values, or promises to deliver
+some result, long before the result is available.
+
+=back
Condition variables are very useful to signal that something has finished,
for example, if you write a module that does asynchronous http requests,
@@ -1059,7 +1075,7 @@
The following is a non-exhaustive list of additional modules that use
AnyEvent as a client and can therefore be mixed easily with other AnyEvent
modules and other event loops in the same program. Some of the modules
-come with AnyEvent, most are available via CPAN.
+come as part of AnyEvent, the others are available via CPAN.
=over 4
@@ -1084,60 +1100,48 @@
Provides rich asynchronous DNS resolver capabilities.
-=item L<AnyEvent::HTTP>
-
-A simple-to-use HTTP library that is capable of making a lot of concurrent
-HTTP requests.
+=item L<AnyEvent::HTTP>, L<AnyEvent::IRC>, L<AnyEvent::XMPP>, L<AnyEvent::GPSD>, L<AnyEvent::IGS>, L<AnyEvent::FCP>
+
+Implement event-based interfaces to the protocols of the same name (for
+the curious, IGS is the International Go Server and FCP is the Freenet
+Client Protocol).
+
+=item L<AnyEvent::Handle::UDP>
+
+Here be danger!
+
+As Pauli would put it, "Not only is it not right, it's not even wrong!" -
+there are so many things wrong with AnyEvent::Handle::UDP, most notably
+it's use of a stream-based API with a protocol that isn't streamable, that
+the only way to improve it is to delete it.
+
+It features data corruption (but typically only under load) and general
+confusion. On top, the author is not only clueless about UDP but also
+fact-resistant - some gems of his understanding: "connect doesn't work
+with UDP", "UDP packets are not IP packets", "UDP only has datagrams, not
+packets", "I don't need to implement proper error checking as UDP doesn't
+support error checking" and so on - he doesn't even understand what's
+wrong with his module when it is explained to him.
+
+=item L<AnyEvent::DBI>
+
+Executes L<DBI> requests asynchronously in a proxy process for you,
+notifying you in an event-bnased way when the operation is finished.
+
+=item L<AnyEvent::AIO>
+
+Truly asynchronous (as opposed to non-blocking) I/O, should be in the
+toolbox of every event programmer. AnyEvent::AIO transparently fuses
+L<IO::AIO> and AnyEvent together, giving AnyEvent access to event-based
+file I/O, and much more.
=item L<AnyEvent::HTTPD>
-Provides a simple web application server framework.
+A simple embedded webserver.
=item L<AnyEvent::FastPing>
The fastest ping in the west.
-
-=item L<AnyEvent::DBI>
-
-Executes L<DBI> requests asynchronously in a proxy process.
-
-=item L<AnyEvent::AIO>
-
-Truly asynchronous I/O, should be in the toolbox of every event
-programmer. AnyEvent::AIO transparently fuses L<IO::AIO> and AnyEvent
-together.
-
-=item L<AnyEvent::BDB>
-
-Truly asynchronous Berkeley DB access. AnyEvent::BDB transparently fuses
-L<BDB> and AnyEvent together.
-
-=item L<AnyEvent::GPSD>
-
-A non-blocking interface to gpsd, a daemon delivering GPS information.
-
-=item L<AnyEvent::IRC>
-
-AnyEvent based IRC client module family (replacing the older Net::IRC3).
-
-=item L<AnyEvent::XMPP>
-
-AnyEvent based XMPP (Jabber protocol) module family (replacing the older
-Net::XMPP2>.
-
-=item L<AnyEvent::IGS>
-
-A non-blocking interface to the Internet Go Server protocol (used by
-L<App::IGS>).
-
-=item L<Net::FCP>
-
-AnyEvent-based implementation of the Freenet Client Protocol, birthplace
-of AnyEvent.
-
-=item L<Event::ExecFlow>
-
-High level API for event-based execution flow control.
=item L<Coro>
@@ -1161,7 +1165,7 @@
use Carp ();
-our $VERSION = '5.261';
+our $VERSION = '5.27';
our $MODEL;
our $AUTOLOAD;
Modified: trunk/libanyevent-perl/lib/AnyEvent/Handle.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Handle.pm?rev=58962&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Handle.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Handle.pm Sun Jun 6 13:15:04 2010
@@ -1,6 +1,6 @@
=head1 NAME
-AnyEvent::Handle - non-blocking I/O on file handles via AnyEvent
+AnyEvent::Handle - non-blocking I/O on streaming handles via AnyEvent
=head1 SYNOPSIS
@@ -33,7 +33,7 @@
=head1 DESCRIPTION
This module is a helper module to make it easier to do event-based I/O on
-filehandles.
+stream-based filehandles (sockets, pipes or other stream things).
The L<AnyEvent::Intro> tutorial contains some well-documented
AnyEvent::Handle examples.
@@ -533,6 +533,12 @@
sub _start {
my ($self) = @_;
+
+ # too many clueless people try to use udp and similar sockets
+ # with AnyEvent::Handle, do them a favour.
+ my $type = getsockopt $self->{fh}, Socket::SOL_SOCKET (), Socket::SO_TYPE ();
+ Carp::croak "AnyEvent::Handle: only stream sockets supported, anything else will NOT work!"
+ if Socket::SOCK_STREAM != (unpack "I", $type) && defined $type;
AnyEvent::Util::fh_nonblocking $self->{fh}, 1;
Modified: trunk/libanyevent-perl/lib/AnyEvent/Socket.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Socket.pm?rev=58962&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Socket.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Socket.pm Sun Jun 6 13:15:04 2010
@@ -799,8 +799,10 @@
can be used as a normal perl file handle as well.
Unless called in void context, C<tcp_connect> returns a guard object that
-will automatically abort connecting when it gets destroyed (it does not do
-anything to the socket after the connect was successful).
+will automatically cancel the connection attempt when it gets destroyed
+- in which case the callback will not be invoked. Destroying it does not
+do anything to the socket after the connect was successful - you cannot
+"uncall" a callback that has been invoked already.
Sometimes you need to "prepare" the socket before connecting, for example,
to C<bind> it to some port, or you want a specific connect timeout that
@@ -896,7 +898,11 @@
return unless exists $state{fh};
my $target = shift @target
- or return (%state = (), _postpone $connect);
+ or return _postpone sub {
+ return unless exists $state{fh};
+ %state = ();
+ $connect->();
+ };
my ($domain, $type, $proto, $sockaddr) = @$target;
More information about the Pkg-perl-cvs-commits
mailing list