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;