Hi all,

I have the following construct using Mojo::Promise:

my $get_data =  sub {
  create new Promise object;
  read data from database
  if data read ok {
    $promise->resolve($data);
  } else {
    $promise->reject('no data');
  }
};


$get_data->()
->then( sub {
  # do something with data
  ...
})
->catch( sub {
  # log error
  ...
})
->wait;

say "the end";

However, I got *"the end*" before running the "do something with data" 
block or catch block. Is there any way to make ->wait really wait?


Thanks,
Michael





-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to