Hello Monks,
I'm working on some asynchronous code and have started using the Promises module. I'm using collect to gather the results of several operations, but am not sure how to wrap a non-async function so that it returns a Promise object. The following example does not work:
my $d = deferred->new;
my $result = External::Parser->run( '--in', $file );
$result
? $d->resolve( $result )
: $d->reject();
$d->promise;