Skip Menu |

This queue is for tickets about the IO-Async CPAN distribution.

Report information
The Basics
Id: 97713
Status: resolved
Priority: 0/
Queue: IO-Async

People
Owner: Nobody in particular
Requestors: frioux [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.64



Subject: SYNOPSIS in ::Function is buggy
The else branch is missing the `sub {`. Also, the then/else branches don't return futures, and thus error: Expected __ANON__(foo.pl line 19) to return a Future. Replacing the then/else with a transform fixes it: $function->call( args => [ 123454321 ], )->transform( done => sub { my $isprime = shift; print "123454321 " . ( $isprime ? "is" : "is not" ) . " a prime number\n"; }, fail => sub { print STDERR "Cannot determine if it's prime - $_[0]\n"; })->get;
You might Test::Synopsis of use.
To be honest, easier just to use on_done/on_fail. Patched. -- Paul Evans
Subject: rt97713.patch
=== modified file 'lib/IO/Async/Function.pm' --- lib/IO/Async/Function.pm 2014-10-17 14:24:46 +0000 +++ lib/IO/Async/Function.pm 2014-10-17 15:07:38 +0000 @@ -39,10 +39,10 @@ $function->call( args => [ 123454321 ], - )->then( sub { + )->on_done( sub { my $isprime = shift; print "123454321 " . ( $isprime ? "is" : "is not" ) . " a prime number\n"; - })->else( + })->on_fail( sub { print STDERR "Cannot determine if it's prime - $_[0]\n"; })->get;
Released -- Paul Evans