Hi, all.
I am refactoring my mojolicious app.
Is there any way to use promise and keep the same return value?
For example:
My original method:
sub some_method {
my $a = block_function_a();
my $b = block_function_b();
my $c = block_function_c(); ### for example many Mojo::Pg search
return $a+$b+$c;
}
Now I change block_function_c to an unblocked promise.
my $a = block_function_a();
my $b = block_function_b();
return promise_mojo_db_search->then(sub($c){
$a+$b+c;
}
);
}
I have to change many relative code after the return value change.
It is very annoying.
Is there any way to return the same value with promise.