On Tuesday, October 1, 2019 at 6:21:13 AM UTC-7, I wrote: > Mojo::UserAgent::Role::PromiseClass now exists on CPAN to play with.
... meanwhile, we now have Mojo::Pg::Role::PromiseClass, which does essentially the same thing for the database methods query_p and friends. i.e., promises returned by ->db->query_p can now be automatically blessed into whatever class you want by just specifying it once on the Mojo::Pg wrapper. (this is ever-so-slightly trickier in that there are actually 2 roles under the hood. But if you're not customizing the Database class, you don't have to care. > > > > > > > $ua = Mojo::UserAgent->new(...) > ->with_roles('+PromiseClass') > ->promise_roles('+Feature'); # add promise features to UserAgent > > $ua->get_p(...)->feature(sub{...}); # and they show up on every get_p call > as opposed to having to type > > > > $ua->get_p(...)->with_roles('+Feature')->feature(sub{...}) > everywhere. -- 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 mojolicious+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/mojolicious/d234c047-07a3-45a8-b797-9d3f84630e93%40googlegroups.com.