Hello,
I'm developing a module that simplifies (a bit) writing test scripts and/or
command-line tools using AnyEvent-powered code.
Its interface currently looks like
use My::Module;
my $result = ae_recv {
do_something ( when_done => ae_send );
} 10; # Timeout is mandatory
# analyze $result later
Of course, all of this can be done via
my $cv = AE::condvar;
my $timer; $timer = AE::timer(...); # ....
but I got tired of copypasting the same boilerplate over and over.
Also, there is a more sophisticated interface called ae_goal that allows to
wait for several conditions at once, much like begin/end, but it uses hash
table instead of a counter.
my $result = ae_recv {
do_connect(22, ae_goal("ssh"));
do_connect(80, ae_goal("http"));
do_connect(443, ae_goal("https"));
} 10;
# ... $result = { ssh => [args], http => [args], https => [args] }
So my questions are:
1) Is there such a module already?
2) If not, how to name it?
The current version is AE::AdHoc, but it's unclear from the name what it does.
I'm almost sure I should throw it away.
A good candidate AE::SendRecv (at least, is resembles the interface), but
would it be OK to take such a sweet spot in the namespace?
--
WBR,
Konstantin S. Uvarin
_______________________________________________
anyevent mailing list
[email protected]
http://lists.schmorp.de/mailman/listinfo/anyevent