On 01/02/2014 10:07 PM, sri wrote:


You two got anything specific in mind you could elaborate on?

--
sebastian


Well, my main thing is that I've got issues with bridges and waypoints, for example I use a bridge to see if a user is authenticated and if they are, it pulls up a wad of information from MongoDB using Mango - the only issue I have is that a bridge must return a value to indicate whether the rest of the chain needs to be handled. Either I do it wrong, or I can't seem to find away to do this in a non-blocking manner, e.g. if I'm in a Mango find_one callback, I can't say "return 1" and have that be the return value for the bridge.

Right now I kludge it together with the around_action hook but I doubt that's what it was meant for, at least, it seems to be a rather sledgehammer-ish solution. I'd love to see a bridge_nb where I'd be able to do stuff like:

sub bridge {
  my $self = shift;
  my $next = shift;

  $self->model('foo.bar')->find_one({ ... } => sub {
    my ($coll, $err, $doc) = (@_);

    if($doc->{foo}) {
      $next->continue;
   } else {
      $next->stop;
   }
});
}

Like I said, maybe it's possible already, I couldn't figure it out so I may be talking up the wrong tree here :D

Basically a way to explicitly request that the dispatcher lets bridges, waypoints, and other such things do it's thing in this fashion would let me deal with it in a nicer way than messing with around_action or even around_dispatch since it just feels too brutal for something like this.

--
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 http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to